Reputation: 89
Simple, I'm doing this:
var loc = window.location;
var fltURI=loc.substr(loc.indexOf("hey?hi=")+7, loc.length);
alert(fltURI);
And I'm getting the error. Please explain also why?
Regards
Upvotes: 2
Views: 7649
Reputation: 5443
use loc as a string...
var loc = window.location.toString();
alert(loc);
var fltURI=loc.substr(loc.indexOf("hey?hi=")+7, loc.length);
alert(fltURI);
Upvotes: 0
Reputation: 1001
window.location is a Location object, and not a string
Try:
var loc = window.location.toString();
var fltURI=loc.substr(loc.indexOf("hey?hi=")+7, loc.length);
alert(fltURI);
Upvotes: 4