Этот сайт имеет ограниченную функциональность, пока мы проводим техническое обслуживание для улучшения его работы. Если какая-либо статья не решила вашу проблему и вы хотите задать вопрос, наше сообщество поддержки ждёт вас: @FirefoxSupport в Твиттере и /r/firefox на Reddit.

Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Подробнее

Is it possible to view websites from local hard drive

  • 6 ответов
  • 1 имеет эту проблему
  • 1 просмотр
  • Последний ответ от Peter Pan

more options

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!

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!

Выбранное решение

'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.

Прочитайте этот ответ в контексте 👍 1

Все ответы (6)

more options

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.

more options

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.

more options

Выбранное решение

'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.

more options

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.

more options

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!

more options

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?