I am trying to allow very primitive customization based on being able to pass a variable through the URL. For example, if they come to my site through the following:
http://my.stackexchange.com?c=alpha
I would be able to display an image, either as an tag or as a background-image, whatever is feasiable, called image-a.png
But if they come through with a different value:
http://my.stackexchange.com?c=beta
Then the image is different.
This would be easier server side, but was wondering if there are ways to do that by, say, using javascript that I can call in the custom header for example. Or some other ideas?
Yes, this has already been placed on meta.stackexchange.com, but I am wondering if there are ideas from the broader programming community on how I can accomplish this with the constraints of only being able to do put html (and limited javascript it seems).
Thanks.
First get your URL parameters with jquery…
Get escaped URL parameter
… or just javascript…
How can I get query string values in JavaScript?
Now that you have the parameters you can use jquery to modify your image tag src parameter…
Change the image source on rollover using jQuery
You can do this without using jquery as well, but I’d go the jquery route because it sounds like you may have complex javascript needs.