Select page graphic based on reffering url

inewman
inewman used Ask the Experts™
on
I have two urls pointing to one website.  I would like to change the header graphic based on the url that is referring to the site.  Is there any way to do this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
cup

Commented:
Are the 2 URLs embedding the page or redirecting to the page

Is client side scripting allowed - if so, which languages

Is server side scripting allowed - if so, which languages

You could save the "come from" site in a server variable and then refer to it in the common page but it depends on what restrictions you have.  Some places have rules like 'no scripting allowed' or scripting only allowed on server side in php.

Author

Commented:
I have one website on a Linux host.  I own two url that are attached to this website.  See http://www.ineedahomebusiness.com and http://www.legalhomebusinessonline.com.

I want to set it up so when someone uses the homebusiness url the header graphic is as it is now.  I someone used the legalhombusiness url I want to display a different header.
cup

Commented:
You could try iframes.   The home page on the website could contain their own individual graphics and have an iframe with something like


  <p>Your browser does not support iframes.



Business.html is just a normal web page without the individual graphics - all the stuff from the second table onwards can go there.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Author

Commented:
I don't think I'm being clear.  I have one website with one home page.  I have two URL referring to this one home page.  I want to be able to change one of the graphics based on which URL is referring to the home page.
cup

Commented:
You could try the Javascript/vbscript variable window.location.href

Author

Commented:
I'm not real familiar with scripting or PHP.  I know I can do this in .NET but my current server won't support .NET.  I need a more specific solution.  Thanks.

Ira
Commented:
Nothing to do with .net - this is a client side soloution.  On your webpage (somewhere between line 21 and 23, where you pop up the .jpg, just put a bit of javascript there.  something like


<td><center>
<script language="javascript">
if (window.location.href == "www.ineedahomebusiness.com")
   document.write ("<img src=\"homebusiness.jpg\" />");
else
   document.write ("<img src=\"legalbusiness.jpg\" />");
</script>
</center>
</td>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial