I hit an error while using Jasmine and Jasmine-Jquery on a Windows 7 machine. Turned out that the root cause of the issue was with a Chrome setting on Windows 7. I spent significant amount of time googling before I found the solution. What tripped me in my Google search was that I kept searching for Jasmine/Jasmine-JQuery errors. This mini-post is to help folk who hit the exact same issue as I did.
I was trying to run fixture.HTML while using Jasmine-Jquery with the loadFixture() method. I was greeted with this strange error message:
This issue had nothing to do with Jasmine-Jquery. It was related with the cross domain policy settings under Chrome. Latest versions of Chrome don’t allow file://URIs to read other file://URIs for security reasons.
One way to solve this problem is to run chrome.exe with the switch
--allow-file-access-from-files. To do so, launch the command prompt and issue the following command:
On my machine, the above command translated to:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --allow-file-access-from-files .
Cautionary note: Do NOT surf the web with the –allow-file-access-from-files setting enabled – it is dangerous! There is a good security reason for why Chrome does not allow local files to access other local files.
© 2013-2017, Rupesh Mishra. All rights reserved.