View Full Version : indexOf() not working

07-30-2008, 03:37 AM
<script language="JavaScript">
if(window.location.indexOf('http://google.com') == -1) {
window.location = 'http://google.com';

The purpose of the script is to see if the user is at google.com, if not they are redirect them to google.com, otherwise not. Its not working and I have no idea why. Help please.

07-30-2008, 03:41 AM
You missed highlighted:

if(window.location.href.indexOf('http://google.com') == -1)

Without the one in red, your script will still work.

07-30-2008, 03:48 AM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum