The following code is giving me an error in Chrome. It seems that window.location.href does not return a String, but that seems crazy.
Here is the code:
var theUrl = "" + window.location.href;
var hashValue = theUrl.contains("#") ? theUrl.split('#')[1] : null; (This is line 6)
This returns the following error in Chrome:
Uncaught TypeError: Object someUrl#someHash has no method 'contains' myFile.js:6
(anonymous function) faq.js:6
k jquery.min.js:2
l.fireWith jquery.min.js:2
p.extend.ready jquery.min.js:2
D
Any ideas?
EDIT: also attempted with document.URL to no avail.
At the moment the
String.containsmethod appears to be only supported by Firefox 19String.contains – JavaScript | MDN
That page also mentions some incompatibilities with MooTools, maybe your problem is related. For the time being you can retrieve the hash value like this