Refael
asked on
every page but the index
Hello Experts,
This if statement I use to distinguish between the index page (home page) and the inner pages of a website.
So... when the page URL have the "index.php" this code works but it does not work when the someone enter the root URL e..g "mydomain.com". How can I make this code work?
This if statement I use to distinguish between the index page (home page) and the inner pages of a website.
So... when the page URL have the "index.php" this code works but it does not work when the someone enter the root URL e..g "mydomain.com". How can I make this code work?
if (window.location.href.indexOf('index') === -1) {}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Read my previous comment. Thank you guys!
Refael, thanks for your feedback to my comment. Both "!=" and will work "!==" in this instance. Using "!==" would require the result to be a string only, however in this instance it makes very little or no difference.
ASKER
I decided to go with skij solution only that i think there is missing one "=" so instead of "!=" it should be "!==", right?