0

For loading a local file into Firefox I have noticed that...

location.href = "./relative/path/file.htm";  //this works
location.href = "http://localhost/path/file.htm";   //this works
location.href = "file:///c:/absolute/path/file.htm"; //doesnt work (also doesnt work if remove the "file:///" bit)

I would like to get the last example to work. Is there some about.config setting I can add to allow this or maybe a "netscape.security.PrivilegeManager..." statement?

(This is for a special Firefox profile and not for general use so the insecurity issues are not relevant). Thanks.

6
  • What's wrong with using the file:/// syntax? Commented Jan 5, 2012 at 18:00
  • @BeRecursive. I meant that if I do: "file://c:/absolute/path/file.htm" it doesnt work either. Commented Jan 5, 2012 at 18:01
  • Is the page that is calling this code on http? Commented Jan 5, 2012 at 18:43
  • Shouldn't the path be using \ instead of /? Commented Jan 5, 2012 at 18:47
  • @epascarello, yes the page running the javascript is also a local page (with address: localhost/...) Commented Jan 5, 2012 at 19:00

2 Answers 2

1

http://kb.mozillazine.org/Links_to_local_pages_don%27t_work#Firefox_1.5.2C_SeaMonkey_1.0_and_newer answers this

Sign up to request clarification or add additional context in comments.

Comments

0

when using "file:///" you need to use backslashes ( windows ) in other words you need to type the physical address of the file as it accessed from file explorer ( windows )

dont forget escape with "\\".

example:

    var url = "file:///c:\\myDir\\1.html";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.