I have a situation where I need to change some CSS on a page based off the URL where the visitor came from. I’m using a form to submit a value to a new page (a checkout page) which is hosted on a different server/site than where the form resides. I have different forms sending this info over to the checkout page on 2 totally different sites. On this checkout page, if the user comes from site A, I need to add a certain class to a div. If the user comes over from site B, I need to add a different class to a div. Something like this:
if incoming URL is equal to www.abc.com, then addClass ('classABC');
if incoming URL is equal to www.xyz.com, then addClass ('classABC');
Am I providing enough information to properly evaluate this? Ideally I’d like to pull this off in jQuery but not sure if there’s an existing plugin that can check this. One thing to note, not all the forms being submitted to the checkout page reside on the same pages (i.e. http://www.xyz.com/index.html). Some may be on different pages through each site, so I need to be able to figure this out based off the primary URL.
Thanks!
It should be possible to read the HTTP Refferer on the serverside. If you can then just put this value into a hidden input field like that
<input type="hidden" value="the referer" id="referer-value"/>and read that hidden value for example using jquery like thisvar referer = $('#referer-value').val();. but as long as you can read the referer on the server you could also directly change the css file serverside.