Skip to main content
Added a test for global variables
Source Link
Wladimir Palant
  • 57.4k
  • 12
  • 99
  • 127

Is there way to access local files not in the current directory on Firefox?

Yes, you set security.fileuri.strict_origin_policy to false. If you've done it already then your problem is caused by something else and you need to ask a different question (preferably with some code). I tested it with the following HTML file:

<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
  jQuery.getScript("file:///.../test.js", function(data, status){
    alert(status + ":\n\n" + data + "\n\n" + window.a);
  });
</script>

With test.js being:

alert("Test succeeded");
var a = 1;

With security.fileuri.strict_origin_policy set to true nothing happens (not even a message in the Error Console). Once it is set to false I see the message "Test succeeded" and then another message saying success: alert("Test succeeded");. As one would expect.

That's Firefox 6.0.1 on Windows 7 x64. Edit: It's the same with Firefox 3.6.21.

Is there way to access local files not in the current directory on Firefox?

Yes, you set security.fileuri.strict_origin_policy to false. If you've done it already then your problem is caused by something else and you need to ask a different question (preferably with some code). I tested it with the following HTML file:

<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
  jQuery.getScript("file:///.../test.js", function(data, status){
    alert(status + ":\n\n" + data);
  });
</script>

With test.js being:

alert("Test succeeded");

With security.fileuri.strict_origin_policy set to true nothing happens (not even a message in the Error Console). Once it is set to false I see the message "Test succeeded" and then another message saying success: alert("Test succeeded");. As one would expect.

That's Firefox 6.0.1 on Windows 7 x64. Edit: It's the same with Firefox 3.6.21.

Is there way to access local files not in the current directory on Firefox?

Yes, you set security.fileuri.strict_origin_policy to false. If you've done it already then your problem is caused by something else and you need to ask a different question (preferably with some code). I tested it with the following HTML file:

<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
  jQuery.getScript("file:///.../test.js", function(data, status){
    alert(status + ":\n\n" + data + "\n\n" + window.a);
  });
</script>

With test.js being:

alert("Test succeeded");
var a = 1;

With security.fileuri.strict_origin_policy set to true nothing happens (not even a message in the Error Console). Once it is set to false I see the message "Test succeeded" and then another message saying success: alert("Test succeeded");. As one would expect.

That's Firefox 6.0.1 on Windows 7 x64. Edit: It's the same with Firefox 3.6.21.

Source Link
Wladimir Palant
  • 57.4k
  • 12
  • 99
  • 127

Is there way to access local files not in the current directory on Firefox?

Yes, you set security.fileuri.strict_origin_policy to false. If you've done it already then your problem is caused by something else and you need to ask a different question (preferably with some code). I tested it with the following HTML file:

<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
  jQuery.getScript("file:///.../test.js", function(data, status){
    alert(status + ":\n\n" + data);
  });
</script>

With test.js being:

alert("Test succeeded");

With security.fileuri.strict_origin_policy set to true nothing happens (not even a message in the Error Console). Once it is set to false I see the message "Test succeeded" and then another message saying success: alert("Test succeeded");. As one would expect.

That's Firefox 6.0.1 on Windows 7 x64. Edit: It's the same with Firefox 3.6.21.