I want to detect if a requested URL contains query string or not.
How can I do so?
I want to detect if a requested URL contains query string or not. How
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.