Loading text files with the require.js error in Firefox: "AccessControlException"

I am using require.js 2.0. I have the following simplified use case:

my html file:

<!DOCTYPE HTML> <html> <head> <title></title> <script type="text/javascript" data-main="apptest.js" src="../_js/libs/require/require.js"></script> </head> <body> </body> </html> 

And then in apptest.js:

 requirejs.config({ paths: { 'text': '../_js/libs/require/text' } }); requirejs( ['text!boxes.html'], function (Boxes) { alert("done"); } ); 

Good, so actually it’s not so much, but enough to understand. Only in Firefox (14.0.1) do I get the exception "uncaught exception: java.security.AccessControlException: access denied (java.io.FilePermission. \ Boxes.html read)".

So, require.js successfully loaded the text plugin, but could not load my html file, which I want to use as a template later. On Google Chrome and even on IE9, it works fine. I am on Windows 7.

I am running this on a local web server, so there are no files here: // ....

I checked if I have special permissions set in the html file, but did not find anything suspicious.

Does anyone have an idea?

Update . Running a test in Firefox 13.0.1 really works for me without errors. So it may be that this is a bug that was introduced in firefox 14?

+4
source share
1 answer

I had the same problem a minute ago. I fixed this by doing the following in the main.js file (where you are configuring)

Front

 require.config({..... 

add the following code:

 Packages = undefined; 

That should do the trick.

You should have something like this:

 Packages = undefined; require.config({ baseUrl: theAppBaseUrl, paths: { 

It is mainly explained that he is trying to use Java to get the file instead of an ajax request (for some reason). This forces it to use the XHR object to retrieve it.

Hooray!

+1
source

All Articles