最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

testing - Runing Javascript In Local HTML Files In Firefox - Stack Overflow

programmeradmin7浏览0评论

How do I get Firefox to run active content such as JavaScript locally? Once upon a time I could find a setting in the about:config but the new versions don't seem to have the same feature, or if it's there I don't know what it is. The closest thing I could find is to setup a local testing environment. I don't want that option.

All users should be able to open the website from a local source and have it work. It works fine in other browsers so long as something equivalent to MSIE's "Allow active content to run in files on My Computer" is selected in the relevant browser options. Where is this option in Firefox? Does it even have it anymore? Been searching all over the place for an answer. This is my last resort before dumping Firefox as an option for local testing.

How do I get Firefox to run active content such as JavaScript locally? Once upon a time I could find a setting in the about:config but the new versions don't seem to have the same feature, or if it's there I don't know what it is. The closest thing I could find is to setup a local testing environment. I don't want that option.

All users should be able to open the website from a local source and have it work. It works fine in other browsers so long as something equivalent to MSIE's "Allow active content to run in files on My Computer" is selected in the relevant browser options. Where is this option in Firefox? Does it even have it anymore? Been searching all over the place for an answer. This is my last resort before dumping Firefox as an option for local testing.

Share Improve this question edited Sep 23, 2019 at 17:41 Alexis Wilke 20.8k11 gold badges104 silver badges177 bronze badges asked Sep 23, 2019 at 17:33 IconMatrixIconMatrix 2153 silver badges6 bronze badges 2
  • 1 What do you mean by "local source"? Are you accessing your HTML directly from Firefox with something like file:///path/to/html/file.html? – Alexis Wilke Commented Sep 23, 2019 at 17:43
  • Search for what I said about the MSIE "Allow active content to run in files on My Computer" setting. That explains it all. <HEAD> <SCRIPT src="Content/Control/JS1_Home.js"></SCRIPT> </HEAD> FireFox used to have a setting in its about:config file, but it's been so long since I used it, I don't remember it, and the browser has been updated so many times, and the about:config, expanded so much, I don't know if it's still there, or if it's been changed. – IconMatrix Commented Sep 24, 2019 at 19:30
Add a ment  | 

4 Answers 4

Reset to default 11

I was confused following the above answers - it seems the privacy.file_unique_origin option is now security.fileuri.strict_origin_policy.

Enable JavaScript in local files:

  1. In Firefox, open up a new tab. Type or paste about:config in the address bar and press Enter.
  2. A button appears asking if you accept the risk to change advanced settings. Click that you accept the risk.
  3. Type unique in the search box, which will filter the list for words containing this word.
  4. Double click the privacy.file_unique_origin preference to switch the value from true to false

Open about:config and set privacy.file_unique_origin to false

There is a flag which is checked when loading data from file://. If true, then those files are not going to be trusted. For JavaScript, this means the script is ignored.

plugins.http_https_only

From the about:config, search for that flag and make sure it's false.

Note that once done with your development, you may want to restore that flag value because otherwise a website could execute code on your puter. This flag is true by default for fairly obvious security reasons.

发布评论

评论列表(0)

  1. 暂无评论