Овај сајт ће имати ограничену функционалност док га будемо ажурирали у циљу побољшања вашег искуства. Ако неки чланак не реши ваш проблем и желите да поставите питање, на располагању ће вам бити наше заједнице подршке @FirefoxSupport на Twitter-у и /r/firefox на Reddit-у.

Претражи подршку

Избегните преваре подршке. Никада од вас нећемо тражити да зовете или шаљете поруке на број или да делите личне податке. Пријавите сумњиве радње преко „Пријавите злоупотребу” опције.

Сазнај више

How to open a local file with a bookmarklet?

  • 1 одговор
  • 1 има овај проблем
  • 5 прегледа
  • Последњи одговор послао the-edmeister

more options

I have offline documentation, which I search with grep, but when I use search engines, I often land on online documentation. I prefer to bookmark the offline equivalent, so I wrote a bookmarklet which swaps the location.

javascript:void(location.href=location.href.replace('https://...', 'file:///...'))

When I click it I get a funny error: "access to file from script denied"

I found an SO page that says that javascript is not allowed to access the file system. http://stackoverflow.com/questions/14052473/go-to-local-url-with-javascript

Fine, but the script is not accessing the file system. It is redirecting. The script itself should have terminated before the page loads. So is this a bug? How do I work around it?

I have offline documentation, which I search with grep, but when I use search engines, I often land on online documentation. I prefer to bookmark the offline equivalent, so I wrote a bookmarklet which swaps the location. javascript:void(location.href=location.href.replace('https://...', 'file:///...')) When I click it I get a funny error: "access to file from script denied" I found an SO page that says that javascript is not allowed to access the file system. http://stackoverflow.com/questions/14052473/go-to-local-url-with-javascript Fine, but the script is not accessing the file system. It is redirecting. The script itself should have terminated before the page loads. So is this a bug? How do I work around it?

Измењено од стране travisfw

Сви одговори (1)

more options

http://stackoverflow.com/questions/14052473/go-to-local-url-with-javascript asked 3 years ago

There have been a number of security changes that affect what is allowed to run in the URL bar in the last 3 years.

I have over 200 Bookmarklets that I have collected over the years, In the last few years I have "lost" a few of them due to security changes in Firefox. Didn't use them often enough to "miss" those that got broken and I'm not a developer so I just deleted them from my bookmarks as I found that they didn't work any longer .

Sorry I can't help you directly or even refer you to relevant information to help besides MDN. https://developer.mozilla.org/en-US/