473,804 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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='"+documen t.referrer+"'>" +referring
page title +"<a>"). I have looked into using location.histor y 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 3252
Christina wrote on 24 okt 2006 in comp.lang.javas cript:
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='"+documen t.referrer+"'>"
+referring page title +"<a>"). I have looked into using
location.histor y 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.net wrote in message
news:Xn******** ************@19 4.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.javas cript:
>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.wri te ("Our thanks to <a href='"+documen t.referrer+"'>"
+referring page title +"<a>"). I have looked into using
location.histo ry 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('r ef')>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.getEle mentsByTagName( '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.net wrote in message
news:Xn******** ************@19 4.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.javas cript:
>>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.writ e ("Our thanks to <a href='"+documen t.referrer+"'>"
+referring page title +"<a>"). I have looked into using
location.hist ory 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.javas cript 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
10109
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, the above call always returns the title of the parent (container) page. Is it possible through JS to deduce the <TITLE> element of the current page, even if that page is a frame?
2
1973
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 add script to the function to either not show the path in the title bar or replace the path with other text? function launchEDoc() { var subWindow window.document.title = "InSight" if (document.forms.EDoc.length){
4
18482
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 "dirty", as seen on editor applications. I use the code below. Venkman shows that everything looks as expected. The last line is for the debugger, which indicates that the title is changed, but it does not display.
9
2371
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 desired title to push the tag off of the screen. (i.e. <title>Document Title &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>) I want to write some javascript to perform the same operation. How would this be written using javascript?
4
58710
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
2970
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 fine... except for one thing, the silly window Title remains "Untitled". Also, in FireFox, it acts as if the window never completely loads, the progress bar stays at the bottom of the small window. Here's the code... as you can see I set the...
2
3191
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> <script language='javascript'> var temp=self.location.href.split("?"); var picUrl = (temp.length>1)?temp:"";
5
11150
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 But the title is inside the head so why I am getting this?
3
3138
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 code: var elementCount = document.all("popupFrame").length;
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.