Have a question regarding URL and jQuery.
Can I specify URL to tell jQuery to run a function?
e.g http://www.website.com/about.html?XYZ
to run a function XYZ();?
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 put code in that web page that examines the query parameters on the URL and then, based on what it finds, calls any javascript function you want.
In your particular example, a simplified version would be like this:
or if you want it to run any function that is present there, you can extract that from the string and run whatever name is there.
Allowing arbitrary javascript to be run in your page may or may not have undesirable security implications. It would be better (if possible) to support only a specific set of pre-existing functions that you look for and know are safe rather than executing arbitrary javascript like the second example.