Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tell if name in query string exists?

Posted on 2012-04-12
3
Medium Priority
?
194 Views
Last Modified: 2012-04-12
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!
0
Comment
Question by:894359
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37840481
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
 

Author Comment

by:894359
ID: 37840495
Why the > 0?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37840496
indexOf return -1 if the string is not found : http://www.w3schools.com/jsref/jsref_indexof.asp
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question