Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 09-01-2006, 01:25 AM   PM User | #1
Pennimus
Senior Coder

 
Join Date: Jul 2005
Location: UK
Posts: 1,051
Thanks: 6
Thanked 13 Times in 13 Posts
Pennimus is on a distinguished road
Automatically Retrieve <title> of Referring Page

Hi all,

Title of the thread says it all really - I'm not even sure whether to be looking for a JS or PHP solution (my instinct is JS). Anyone have any ideas?

Regards
Pennimus is offline   Reply With Quote
Old 09-01-2006, 01:34 AM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 5,244
Thanks: 4
Thanked 417 Times in 415 Posts
mlseim will become famous soon enoughmlseim will become famous soon enough
So I assume you already are able to see what the referring page is?
You just want to grab the title?

Or, are you thinking about opening a log file and reading in the referring
URLs ...

I'm not sure how you are seeing the referral URLs to begin with.
__________________


.
mlseim is offline   Reply With Quote
Old 09-01-2006, 01:49 AM   PM User | #3
Pennimus
Senior Coder

 
Join Date: Jul 2005
Location: UK
Posts: 1,051
Thanks: 6
Thanked 13 Times in 13 Posts
Pennimus is on a distinguished road
Sorry, the referring URL is in the query string. I'm creating a bookmarking system where you have a button on your toolbar with this JS function:

Code:
javascript:location.href='http://www.example.com/bookmark.php?url='+encodeURIComponent(location.href)"
If you know del.icio.us, it's basically that kind of deal.

EDIT: I've just realised I can probably encode the title at the same time as the URL. Doh! *potters off to try that out*
EDIT: It works, kind of...

These two functions work seperately to get the two bits of information I need:

Code:
+encodeURIComponent(location.href)
Code:
+encodeURIComponent(document.title)
However, I'm not sure how to combine them to get the query string I need, which would look something like ?url=[referring url]&title=[referring title]. It's the apostrophes seperating up the link and the encodeURI functions that are playing up. Having tried the obvious (JS in red for clarity)...

Code:
javascript:location.href='http://www.example.com/bookmark.php?url='+encodeURIComponent(location.href)'&title='+encodeURIComponent(document.title)"
... I've come to the end of my javascript expertise :-D Anybody know how to toggle these two last bits together properly?

Last edited by Pennimus; 09-01-2006 at 02:11 AM..
Pennimus is offline   Reply With Quote
Old 09-01-2006, 03:06 AM   PM User | #4
felgall
Senior Coder

 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 2,275
Thanks: 0
Thanked 23 Times in 22 Posts
felgall will become famous soon enough
You left out the + in href)+'&title
__________________
Stephen
Helping others to solve their computer problem at http://www.felgall.com/
Web related ebooks and software - http://members.felgall.com/
Focus on Javascript - http://javascript.about.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:54 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.