Forum Moderators: DixonJones

Message Too Old, No Replies

Title image changes based upon referrer

will different urls will display different logo?

         

wintercornuk

3:39 pm on Nov 16, 2004 (gmt 0)

10+ Year Member



I'm designing a new site which will have several urls pointing in. The main domain will be widgets and the others are widget1, widget2 etc.

When people come in via widgets the logo will be widgets, but how can I get a different image show dependent upon the referring url? Is this even possible (simply...)?

pete_m

10:39 pm on Nov 16, 2004 (gmt 0)

10+ Year Member



It's certainly possible to vary the logo, although you'll need to do some scripting to make it happen.

If you need to change the logo based on the current domain name, you can use JavaScript if you like. Just get the current

document.location.href
, parse it for the domain name, and set the properties on an image accordingly.

A more reliable way is to use server-side scripting. You can retrieve the current domain name in a similar way to JavaScript and set the relevant image src attribute. You can use any server-side technology - PHP, ASP, Perl, even an Apache htaccess file if you were feeling particularly masochistic.

If you want to set the logo based on the referer (i.e. the URL of the page that links to this one) you can use

document.referer
instead of
document.location.href

Again, server-side code will be more reliable.

wintercornuk

9:06 am on Nov 17, 2004 (gmt 0)

10+ Year Member



Can you give me any examples please? I'm new to this level of complexity.