HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
keep track of referring pages on an index.html page
Post new topic   Reply to topic    HTML Help Forum -> Javascript
View previous topic :: View next topic  
Author Message
CaidZamora



Joined: 28 Jul 2005
Posts: 4

PostPosted: Thu Jul 28, 2005 9:19 am     keep track of referring pages on an index.html page Reply with quote

How to keep track of the referring pages.

I use PHP to keep track of the referring pages but I can do it only for the second page which uses PHP and mysql (page2.php). I cannot keep track of the pages referring to my index page which is HTML (index.html).


thank you very much for your help.
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Thu Jul 28, 2005 12:20 pm     Reply with quote

You would need to use server-side scripting if you want the index to record referrers.

The easiest way would be to change your index.html to index.php and add the appropriate coding.

If you don't want to do this because it means changing the extension then if you have apache you can tell it to process your .html files through the PHP processor.
CaidZamora



Joined: 28 Jul 2005
Posts: 4

PostPosted: Fri Jul 29, 2005 12:55 am     index.html imposed by ISP. What about this? Reply with quote

Thank you for the quick response.
the index.html is imposed on me by the ISP

I wanted to use JavaScript to detect the referring page.
If there is a way I can put the referring URL on a variable, call the second page and pass the variable (such as page2.php?URLVAR). Then process the variable with php and store it in a MySql table.

Does this make sens at all?

Thank you very much. I really appreciate your help.

CaidZamora
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Fri Jul 29, 2005 4:32 am     Reply with quote

You could do it with javascript

Code:

<script type="text/javascript">
if(document.referrer){
window.location.replace("page2.php?refer=" + escape(document.referrer));
}
</script>



page2.php
Code:

<?php
if(isset($_GET['refer'])){
echo "Referrer: " . $_GET['refer'];
}
?>
CaidZamora



Joined: 28 Jul 2005
Posts: 4

PostPosted: Fri Jul 29, 2005 5:26 am     Thanks Reply with quote

Very nice of you. I will try it tonight and let you know.
Thank you very much.
CaidZamora



Joined: 28 Jul 2005
Posts: 4

PostPosted: Wed Aug 03, 2005 2:59 pm     Reply with quote

Did not work.
I inserted the code on the index page and page2.php with the correct file names of course but my webpage was no longer found (ISP=lycos/tripod/uk)
As soon as I take out the code on the first page, I can access the index.html page again. Weird, hein!

Thanks for helping
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Thu Aug 04, 2005 10:53 am     Reply with quote

could be a lycos thing. They have a tendancy to mess up scripts.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> Javascript All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial