Forum Moderators: open

Message Too Old, No Replies

Check Referer and frames _PLEASE HELP

When refered from Google people come to a page. How to put the frames in?

         

ensingg

9:13 am on Apr 17, 2004 (gmt 0)

10+ Year Member



I have a normal website with two frames. Menubuttons on the leftside and the page in the other frame.

When people found our side through google them sometimes come to the page directly. The page is not shown in a frame but full-screen. Is it possible to put the frames / menubar depending on the referer?

Please help!

I am a VB programmer, feeling for programming but not an expert in javascript ;-)

Rambo Tribble

2:18 pm on Apr 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't have time to give you a full explanation, but the document.referrer property of the document object should allow you to check the referrer source. Then a switch or cascading if should allow your frame variations.

What you really need is a DOM reference, like Goodman's Dynamic HTML on O'Reilly.

ensingg

2:33 pm on Apr 17, 2004 (gmt 0)

10+ Year Member



What I allready did :

fruit.html

<script language=JavaScript>
// set up a var called myref to obtain the referrer
myref=document.referrer;
// get the position of the first '/' after 'http://' in th referrer
numchar=myref.indexOf('/',7);
// extract the baseURL from the referrer
myBaseURL = myref.substr(0,numchar);
// test if the baseURL is the URL you want it to be and if not redirect
if(myBaseURL!= 'http://www.degezondeapotheker.nl') window.location.href = 'http://www.degezondeapotheker.nl/fruit0.html';
</script>

And in the fruit0.html the following:

<FRAMESET cols="10%,1*" frameborder="no" border="0" framespacing="0">
<FRAME name="menu" scrolling="NO" noresize src="menu.html" title="">
<FRAME name="start" src="fruit.html" title="">
</FRAMESET>

So it starts fruit.html again.

Is this possible in just one page?

Rambo Tribble

1:42 am on Apr 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since, by the HTML definition, a frameset page is supposed to stand alone, I don't think it would be desirable to create one page that loaded either/or. You might want to look into iframes (independent frames), though.