Jasmine-Jquery error: object doesn’t support this property or method

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:

TypeError: Object doesn’t support this property or method
Error: Fixture could not be loaded: spec/javascripts/fixtures/fixture.html

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:
$CHROME_DIR\chrome.exe --allow-file-access-from-files
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.


Leave a Reply

Your email address will not be published. Required fields are marked *