A couple of observations:
indexof should be indexOf
The url is already a string so you don’t need String(url). You should be able to use url.indexOf()
If the string you are looking for is a query string of the URL, then you might consider using the query property.