473,396 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

title of referring document

I can't seem to find any reference for grabbing the title of the referring
page, which I want to use for creating a link. i.e.
document.write ("Our thanks to <a href='"+document.referrer+"'>" +referring
page title +"<a>"). I have looked into using location.history also. This is
probably a standard thing, but through all the forums and searches I only
find a mishmosh of things referring to using frames, a different scripting
language, etc. Can someone guide me on this?

Thanks,
Chris
Oct 24 '06 #1
5 3201
Christina wrote on 24 okt 2006 in comp.lang.javascript:
I can't seem to find any reference for grabbing the title of the
referring page, which I want to use for creating a link. i.e.
document.write ("Our thanks to <a href='"+document.referrer+"'>"
+referring page title +"<a>"). I have looked into using
location.history also. This is probably a standard thing, but through
all the forums and searches I only find a mishmosh of things referring
to using frames, a different scripting language, etc. Can someone
guide me on this?
That is not possible.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 24 '06 #2
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>
That is not possible.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Thanks, I was afraid of that. I have seen breadcrumb scripts using loops
and cookies that grab document titles from pages on the current site, but
had hoped there was something that could be done for this.

Is it possible to grab the title of an on-site page without using a cookie?
Some of those scripts just seem to get so complicated and people rarely
insert comments in them so I start to lose track of what each part is doing,
or why. As you can tell, I'm a novice, but I am trying to learn.

Chris
Oct 24 '06 #3
ASM
Evertjan. a écrit :
Christina wrote on 24 okt 2006 in comp.lang.javascript:
>I can't seem to find any reference for grabbing the title of the
referring page, which I want to use for creating a link. i.e.
document.write ("Our thanks to <a href='"+document.referrer+"'>"
+referring page title +"<a>"). I have looked into using
location.history also. This is probably a standard thing, but through
all the forums and searches I only find a mishmosh of things referring
to using frames, a different scripting language, etc. Can someone
guide me on this?

That is not possible.
to give to each link in the file the page title reference,
and alert about title of previous page seen (if it has same script)

function follow() {
var L = self.location+'';
if(L.indexOf('ref')>0) {
if(L.indexOf('#')>0) L = L.substring(0,L.indexOf('#'));
mesg = L.split('?')[1].split('&');
for(var i=0; i<mesg.length; i++) eval(mesg[i]);
alert('Thanks to have seen '+unescape(ref));
}
var ref = document.title;
var A = document.getElementsByTagName('A');
for(var i=0; i<A.length; i++) {
var H = A[i].href;
if( H && H.length>0 && (H.indexOf('#')<0 || H.indexOf('#')>1) )
{
if(H.indexOf('#')>0) { H = H.split('#'); A[i].href = H[0]; }
A[i].href += H.indexOf('?')<0? '?' : '&';
A[i].href += "ref='"+ref+"'";;
if(H.length==2) A[i].href += "#"+H[1];

}
}
}
onload = follow;

--
ASM
Oct 24 '06 #4
ASM
Christina a écrit :
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>That is not possible.
Is it possible to grab the title of an on-site page without using a cookie?
what is not possible is to know the tltle of a page has gone away
(when new page is displayed (loaded) the previous one is no more there
to give its title)

So you have 2 methods :
- attach title of the page to each links
then you :
read location of page to extract title of previous page
- have a cookie to stock in it titles of displayed and previous pages
then
read the cookie to extract title of previous page
Some of those scripts just seem to get so complicated and people rarely
insert comments in them so I start to lose track of what each part is doing,
or why. As you can tell, I'm a novice, but I am trying to learn.
in my previous post I gave an idea to set title to each link and to get
previous page's title

without any comment ! :-(
but tested.
call for comments if necessary

You just have to copy-paste it in an external js file
and to put a call to this file in your pages (in header)

--
ASM
Oct 24 '06 #5
ASM said the following on 10/24/2006 6:18 PM:
Evertjan. a écrit :
>Christina wrote on 24 okt 2006 in comp.lang.javascript:
>>I can't seem to find any reference for grabbing the title of the
referring page, which I want to use for creating a link. i.e.
document.write ("Our thanks to <a href='"+document.referrer+"'>"
+referring page title +"<a>"). I have looked into using
location.history also. This is probably a standard thing, but through
all the forums and searches I only find a mishmosh of things referring
to using frames, a different scripting language, etc. Can someone
guide me on this?

That is not possible.

to give to each link in the file the page title reference,
and alert about title of previous page seen (if it has same script)
Did you test that where the referring page was from another domain? You
can't get the title of a document in a different domain using JS in a
default security environment. Your code will work with pages from within
your own site but that is as far as it can go unless you get people who
link to you to include the title of the page in the link to your page
(should be interesting to see you try to get Google to do that for you :))

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: D. Alvarado | last post by:
Hello, I am trying to find the <TITLE> element of my document. Normally alert(document.title); works just fine, but when this statement is within a page that is a frame in a larger document,...
2
by: Paul Moffitt | last post by:
We have a Javascript function that opens an electronic document in a subwindow. The Title bar of the subwindow shows the filepath of the document. Looking at the script below is there any way to...
4
by: Richard Trahan | last post by:
(This is a repost -- the original got tucked away into an old thread because I used the same Subject name.) I'm trying to change the document title to add an asterisk when the document becomes...
9
by: Ian Renfrew | last post by:
Essentially, I want to prevent the display of the Microsoft Internet Explorer or any other branding tag in the document title. One technique that I've used is to insert multiple spaces after the...
4
by: laredotornado | last post by:
Hello, How do I use Javasript to get the <TITLE> element of a web page? If anyone can supply a cross browser way (IE 5.5+, Firefox 1+), it is most appreciated. Dave
9
by: rolandgust | last post by:
I've written some code that creates a pop-up window to play back QuickTime movies and then pushes HTML into that window so I don't have to have a separate HTML file for every movie. The code works...
2
by: skim1114 | last post by:
I have this code in my popup window, which works perfectly except that I need it to display a new title for every image. Here the popup window code: <HTML> <HEAD> <TITLE>DETAIL</TITLE>...
5
by: garfy | last post by:
Hi i get this error in validation Line 22 column 6: document type does not allow element "title" here. <title>Seo Web Design Los Angeles - Web Design And Search Engine Optimization L ...
3
by: Adam Lipscombe | last post by:
Folks, I want to be able to get title of a document that is presented within an Iframe with the id "popupFrame". There may be more than 1 instance of the iframe in the page. This is my...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.