4 ms·
Well, if you double-click on a html file on your computer, it will open that in your browser using file://. If you use the short `//example.com/foo.bar`, it is
by somesay 14y ago
Well, if you double-click on a html file on your computer, it will open that in your browser using file://. If you use the short `//example.com/foo.bar`, it is quite problematic.
`//fonts.googleapis.com/css` becomes `file://fonts.googleapis.com/css` → doesn't work
Additionally, JavaScript files might not load or work due to browsers' (security) limitations. Not sure about the exact details here.
- stcredzero 14y agoDefinitely sounds like file:// is problematic, then.
- jtheory 14y agoUsing a local server (instead of file:// access) would be a solution to that problem, not another problem. That's not great... A lot of folks get started editing HTML by downloading an existing page, editing it in some small way, and viewing the resulting page to see if it worked. This would break that approach.
- Hello71 14y agoFirefox saves all assets to a _files directory then fixes the URLs to point in there. If you really, really want to use //: busybox httpd -p 8080
- khuey 14y agoor python -m SimpleHTTPServer 8080
- gingerlime 14y agoI agree, and I think not just for novice people editing HTML pages. Being able to load HTML pages locally, or send them in a zip file is important some times. When I built Giraffe[1], a front-end for Graphite, one of my aims was that people can launch the dashboard from their desktop, then add dashboards to it by editing one file locally. So most of these people will use a server one day, but forcing them to launch a local server before they even start, really decreases the ability to play with it instantly and try it out... the code in giraffe's index.html needs to work both on the server and locally. I already experienced strange behaviour with loading JSON/JSONP from a file:// based url, and I know it's an edge case, but it's still a useful use-case in my opinion. [1]http://kenhub.github.io/giraffe http://kenhub.github.io/giraffe
- kyrias 14y agoIt's not file:// that's problematic, it's that you're using relative protocol URLs without an actual server to be relative to
- somesay 14y agoGuy, you haven't got this right.