Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
javascript question
I was wondering if someone can help me with an easy javascript question.
A simple if/then statement, that checks the URL of a page and if a certain term exists, i would like to call a function....
for example:
if document.domain == "abc" then call a function....
i know, it's easy......and i know, this is probably the wrong forum... but this place seems to have it together.... a very cool crew that knows their stuff....
take care....
0
This discussion has been closed.
Comments
var h = window.location.host;
if you want to search the whole URI (http://www.host.com/etc/etc?etc#etc):
var h = window.location.href;
if you only want to search the path (/etc/etc?etc#etc):
var h = window.location.pathname;
and then after whichever one of those you use, add:
if(h.indexOf("myString") > -1) { // string found } else // string not found }