简体   繁体   中英

Why can't I open this html page locally without an IIS Server?

I am currently working on a for fun project at

https://github.com/loganhenson/jsrpg

and have been working on it with a friend using visual studio professional and testing it on my local iis server. The way I understood it was that because it is only html/javascript/css, I should be able to simply open the html page in the browser and have it run, however that is not the case. It only works when either on a local iis server or on a hosted server.

Please clear up my misconceptions!

I have run into problems with web pages that were just opened as you described instead of running on a server when the page omits the HTTP/HTTPS protocol on linked js and css files. In your particular file, you point to jQuery on Google's CDN using //ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js . Change that to https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js and it works properly.

All of the coding looks like it should load without IIS being installed. Assuming you are targeting the correct Framework, there should be no problems. If you are trying to use the "preview" button, that might need IIS to be installed.

You can also open the file locally. If you do it this way, there is no need for IIS to be installed because it is the same as caching a webpage or saving it for offline viewing. This is the method I always use. After saving the new coding to the file, switch over to the internet browser and press F5 or the refresh button and you will see your changes.

http://www.microsoft.com/web/gallery/install.aspx?appid=IISExpress is the web address to go to if you need to install IIS. You have to first download and install Web Platform Installer (this link will do that) and then select and install IIS Express. It is free to use and will work if you are still needing IIS installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM