Chrome XMLHttpRequest cannot load #4

Closed
stevehorn opened this Issue Oct 30, 2010 · 9 comments

Comments

Projects
None yet
7 participants
@stevehorn

When trying to use loadFixtures() to load a local html file, Chrome (v7.0.517.41) returns this error:
Origin null is not allowed by Access-Control-Allow-Origin.

Is there a browser setting that I can tweak to get around this error? Firefox and IE both work fine.

@velesin

This comment has been minimized.

Show comment
Hide comment
@velesin

velesin Oct 30, 2010

Owner

Hi,
I tested it under Chrome and loadFixtures worked - although it was tested on a lower version than 7.0. I'll check if it is the issue with a Chrome version upgrade or configuration settings.

Owner

velesin commented Oct 30, 2010

Hi,
I tested it under Chrome and loadFixtures worked - although it was tested on a lower version than 7.0. I'll check if it is the issue with a Chrome version upgrade or configuration settings.

@stevehorn

This comment has been minimized.

Show comment
Hide comment
@stevehorn

stevehorn Nov 1, 2010

"By default, file:// URIs cannot read other file:// URIs. This is an override for developers who need the old behavior for testing."

--allow-file-access-from-files

http://peter.sh/experiments/chromium-command-line-switches/

"By default, file:// URIs cannot read other file:// URIs. This is an override for developers who need the old behavior for testing."

--allow-file-access-from-files

http://peter.sh/experiments/chromium-command-line-switches/

@velesin

This comment has been minimized.

Show comment
Hide comment
@velesin

velesin Nov 5, 2010

Owner

So it seems it solves the problem...?
Big thanks for the info!

Owner

velesin commented Nov 5, 2010

So it seems it solves the problem...?
Big thanks for the info!

@tonyarkles

This comment has been minimized.

Show comment
Hide comment
@tonyarkles

tonyarkles Nov 26, 2010

Might be worth putting this in the documentation, I just got burned by it. It'd be great if there were an alternative way to work around this that didn't involve passing command-line switches to Chrome, but I can't think of one off the top of my head.

Might be worth putting this in the documentation, I just got burned by it. It'd be great if there were an alternative way to work around this that didn't involve passing command-line switches to Chrome, but I can't think of one off the top of my head.

@SonlyF5020

This comment has been minimized.

Show comment
Hide comment
@SonlyF5020

SonlyF5020 Jul 19, 2013

I placed a fixture html(qiu.html) under the path "spec/javascripts/fixtures"
and I used a loadFixture('qiu.html');

but I got a faild to load resource: Origin null is not allowed by Access-Control-Allow-Origin:
file://localhost/Users/twer/Downloads/jasmine-standalone-1.3.1/jasmine-jquery/spec/javascripts/fixtures/Qiu.html

what is wrong with my jasmine-jquery? Anyone can help me?

I placed a fixture html(qiu.html) under the path "spec/javascripts/fixtures"
and I used a loadFixture('qiu.html');

but I got a faild to load resource: Origin null is not allowed by Access-Control-Allow-Origin:
file://localhost/Users/twer/Downloads/jasmine-standalone-1.3.1/jasmine-jquery/spec/javascripts/fixtures/Qiu.html

what is wrong with my jasmine-jquery? Anyone can help me?

@travisjeffery

This comment has been minimized.

Show comment
Hide comment
@travisjeffery

travisjeffery Jul 19, 2013

Collaborator

(It should be loadFixtures('qiu.html').) if you're using Chrome follow this: https://github.com/velesin/jasmine-jquery#cross-domain-policy-problems-under-chrome, or if you're using a Mac could use Safari too.

Collaborator

travisjeffery commented Jul 19, 2013

(It should be loadFixtures('qiu.html').) if you're using Chrome follow this: https://github.com/velesin/jasmine-jquery#cross-domain-policy-problems-under-chrome, or if you're using a Mac could use Safari too.

@SonlyF5020

This comment has been minimized.

Show comment
Hide comment
@SonlyF5020

SonlyF5020 Jul 19, 2013

I tried Chrome and Safari or even Firefox, the error still exist.

After all I coped the code in qiu.html into the QiuSpecRunner.html and then deleted the sentence "loadFixtures('qiu.html')". Now it works very well!

Thank you anyway!

On Jul 19, 2013, at 12:07 PM, travis jeffery notifications@github.com wrote:

(It should be loadFixtures('qiu.html').) if you're using Chrome follow this: https://github.com/velesin/jasmine-jquery#cross-domain-policy-problems-under-chrome, or if you're using a Mac could use Safari too.


Reply to this email directly or view it on GitHub.

I tried Chrome and Safari or even Firefox, the error still exist.

After all I coped the code in qiu.html into the QiuSpecRunner.html and then deleted the sentence "loadFixtures('qiu.html')". Now it works very well!

Thank you anyway!

On Jul 19, 2013, at 12:07 PM, travis jeffery notifications@github.com wrote:

(It should be loadFixtures('qiu.html').) if you're using Chrome follow this: https://github.com/velesin/jasmine-jquery#cross-domain-policy-problems-under-chrome, or if you're using a Mac could use Safari too.


Reply to this email directly or view it on GitHub.

@NPC

This comment has been minimized.

Show comment
Hide comment
@NPC

NPC Apr 16, 2015

Could the same issue happen with Internet Explorer?

My tests run fine in Firefox, yet in IE11 (v11.0.9600.17728, to be precise) I get the same number of failed tests as in Chrome, while tests that don't attempt to load fixtures work fine.

Here's the error:

Error: Fixture could not be loaded: [filename].html (status: error, message: Access is denied.
)
at Anonymous function (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:133:11)
at l (file:///D:/[path]/JQuery/jquery-2.0.0.min.js:4:24576)
at c.add (file:///D:/[path]/JQuery/jquery-2.0.0.min.js:4:24894)
at jasmine.Fixtures.prototype.loadFixtureIntoCache_ (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:124:9)
at jasmine.Fixtures.prototype.getFixtureHtml_ (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:115:7)
at jasmine.Fixtures.prototype.read (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:77:7)
at jasmine.Fixtures.prototype.load (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:65:5)
at jasmine.Fixtures.prototype.proxyCallTo_ (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:161:5)
at window.loadFixtures (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:782:5)
at Anonymous function (file:///D:/[path]/JS.Tests/PPM/[my_tests_file].js:44:17)

NPC commented Apr 16, 2015

Could the same issue happen with Internet Explorer?

My tests run fine in Firefox, yet in IE11 (v11.0.9600.17728, to be precise) I get the same number of failed tests as in Chrome, while tests that don't attempt to load fixtures work fine.

Here's the error:

Error: Fixture could not be loaded: [filename].html (status: error, message: Access is denied.
)
at Anonymous function (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:133:11)
at l (file:///D:/[path]/JQuery/jquery-2.0.0.min.js:4:24576)
at c.add (file:///D:/[path]/JQuery/jquery-2.0.0.min.js:4:24894)
at jasmine.Fixtures.prototype.loadFixtureIntoCache_ (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:124:9)
at jasmine.Fixtures.prototype.getFixtureHtml_ (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:115:7)
at jasmine.Fixtures.prototype.read (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:77:7)
at jasmine.Fixtures.prototype.load (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:65:5)
at jasmine.Fixtures.prototype.proxyCallTo_ (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:161:5)
at window.loadFixtures (file:///D:/[path]/JS.Tests/Utils/jasmine-jquery.js:782:5)
at Anonymous function (file:///D:/[path]/JS.Tests/PPM/[my_tests_file].js:44:17)

@cameronroe

This comment has been minimized.

Show comment
Hide comment
@cameronroe

cameronroe Feb 17, 2016

Is there anyway to just use something like https://github.com/karma-runner/karma-html2js-preprocessor and then converting it back into a string.

Is there anyway to just use something like https://github.com/karma-runner/karma-html2js-preprocessor and then converting it back into a string.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment