Is This Even Possible?

by WillR
2 replies
Warriors,

Ok, I may be barking up the wrong tree here but hey, I thought anything was possible on computers... right?!

So lets say I have a webpage with a script code inside the html. Is there anyway I could then add something to the end of the url (eg: website.com/page.html?s=off) that could somehow make it so the script is not activated when that string is added to the end of the url.

I basically only want the script to run some times so I need a way of having it disabled or removed just by adding something to the end of the url for that page.

Possible?

Edit: I might also add that I want to be able to achieve this WITHOUT any php.
  • Profile picture of the author wayfarer
    Sure it's possible, but JavaScript can only see the entire window.location.pathname as a single string, so you'll need to parse the query parameters yourself. It won't separate out the parameters into an array of variables like PHP does (with the $_GET array).
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[3983800].message }}
  • Profile picture of the author wayfarer
    I might add it's considered better practice to pass client side scripts variables by placing everything after a hash mark (/page.html#s=off). Nothing after a hash is sent to the server, and this won't confuse search spiders into considering that there might be a different page at that location.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[3983882].message }}

Trending Topics