Tell if name in query string exists?

If i have a URL like below

http://mySite.com/store/en_US/pd/productID.225126100/sac.true?gaikaiInstantPlay

what is the best way to determine if "gaikaiInstantPlay" is in the URL?

Thanks!
894359Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
leakim971Connect With a Mentor PluritechnicianCommented:
var gaikaiInstantPlay_is_in_the_URL =  location.href.indexOf("gaikaiInstantPlay") > 0; // this is true or false

if( gaikaiInstantPlay_is_in_the_URL ) alert("ok");
else alert("not in the URL");

Open in new window

0
 
894359Author Commented:
Why the > 0?
0
 
leakim971PluritechnicianCommented:
indexOf return -1 if the string is not found : http://www.w3schools.com/jsref/jsref_indexof.asp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.