Link to home
Create AccountLog in
Avatar of MayoorPatel
MayoorPatel

asked on

Need to Execute this this JS code 1/3 times

I have this code on my page but only want to execute it randomly one in three times

if (document.URL == "http://www.google.com")
{
window.location = "http://www.facebook.com";
}

Is there some code I can put around it to do this. Its javascript
ASKER CERTIFIED SOLUTION
Avatar of Graham N.
Graham N.
Flag of United Arab Emirates image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer