Is it possible to view websites from local hard drive
I like to test my web pages as much as possible at home before uploading to a server. I do this by setting up empty drive partitions for my various sites, so that 'root level" access will work similarly on a server or from the hard drive. So, for example, a line on a page like...
<script src="/scripts/siteScripts2.js"> </script>
or
<link rel="stylesheet" type = "text/css" href="/styles/fonts/fonts.css"> <link rel="stylesheet" type = "text/css" href="/styles/spcPageStyles1.css" >
Will reference the files from the root level, as if it was on a server.This works all the time with Chrome and IE, even back to IE-8. So Mozilla Firefox must be blocking file references from local hard Drive root level. If there is a config variable or two I can set to allow it from firefox, I'd appreciate knowing about it. I'm satisfied testing with Chrome and IE, but FF is an important browser to test with.
Thanks in advance!
Solução escolhida
'Root' level access via "/styles/fonts/fonts.css" works relative to the folder where the HTML file is located. You can't go back in the directory tree to access other folders starting with root.
Ler esta resposta 👍 1Todas as respostas (6)
If you writing your own page there should be something in the software you using to preview or test the page. You should check with the software maker your using to write your web page to see if they have a built in function to do that. I know most should as this helps them revise or redo pages before uploading as well.
Thanks @Westend, but since both Chrome and IE (at least older versions) do allow you to properly load and view a site on your local drive, and even treat "root level" links as if they just referred to the root level of the hard drive (EG: D:\ or E:\), I'd just like to know why I can't do the same with Firefox, and whether there is a simple configuration change that will allow it.
I'm a hand coder so there is no special software I use for development. But even if I did, when I say "test" pages, I mean I like to see how the page will appear in various browsers and versions of browsers. Even if I used special software that allowed a browser view, it would not accurately simulate Chrome, Firefox, IE (various versions) or safari. If all browsers identically implemented CSS and their internal DOM, testing with just one browser would be enough.
Solução escolhida
'Root' level access via "/styles/fonts/fonts.css" works relative to the folder where the HTML file is located. You can't go back in the directory tree to access other folders starting with root.
cor-el said
'Root' level access via "/styles/fonts/fonts.css" works relative to the folder where the HTML file is located. You can't go back in the directory tree to access other folders starting with root.
Yes...thanks... I've found that too. while updating my pages, I'd heard repeatedly (though I don't know why) that it better to reference things to the root, and even use full URLs. I didn't do the latter, but I did start referencing all resources to the "/" root, and thans when it broke Firefox's ability to render the pages with links styles and JS scrips. Its just odd that Chrome and the lowly IE (at least my versions) do allow it. I guess I'll just live with it. Thanks.
Note that I've purposely dedicated a drive partition entirely to the site I'm working on. So If the site page is at E:\mypage.html, a link to ""/styles/fonts/fonts.css" should work, because that is EXACTLY where the fonts.css file is. And as i said, it WORKS in Chrome and IE. But not in FF!
Finally, I'm sure at this point that the inability of FF to access the kind of embedded links to root level resources I've described is NOT a bug, but intentional. I'm sure it is a security measure. So what I would like to know is, how do i request the software authos reconsider this block, and and allow developers (who surely KNOW the risks ) to override it with a setting or config variable?