tags:

views:

49

answers:

2

hi all i want to detect if a requested url contains query string or not how to do so ?

+3  A: 

You can directly use getQueryString() method

OR

You can check if your url has a query string or not by splitting it on "?" or finding index of the "?" character.

On splitting, your result array must have atleast length greater than 1 and if you take the index route, then the index must be greater than 0 since first character cant be a "?" assuming you will have correct url entered to check for query string.

Sachin Shanbhag
+1  A: 

Something like requestedUrl.indexOf("?") > 0 should do. Because query string parameters are passed by appending ? to the url and then name/value pairs follow.

Faisal Feroz