473,396 Members | 1,982 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.

Javascript - display referrer

Hi all,
I'm trying to create some javascript that will provide the user of the
referring page, but if I do something like the following:

<HTML>
<HEAD>
</HEAD>
<BODY>

<script>
<!--
url= document.referrer;

document.write('<A HREF="' + url + '">This Link</A>');
//-->
</script>

</BODY>

</HTML>

this brings out a drop-down window on IE 6 (using WInXP SP2) saying
"active content is blocked" etc. However, similar useage of the same
document.referrer function in another page I have seen is OK. What is
wrong? The behaviour is the same if the <scripttag contains
"JavaScript", or not.

Also, if I have a link to the page containing the code above on a
webpage (say "C:\Trev\refer1.htm"),
then the referrer is given as "C:\Trev", and not the actual webpage
referrer. Why?

TIA

Trev

Oct 17 '06 #1
10 8736
Trev said the following on 10/17/2006 5:49 AM:
Hi all,
I'm trying to create some javascript that will provide the user of the
referring page, but if I do something like the following:
<snip>
<script>
<!--
<script type="text/javascript">

Drop the antiquated potentially-harmful comments.
url= document.referrer;

document.write('<A HREF="' + url + '">This Link</A>');
<snip>
this brings out a drop-down window on IE 6 (using WInXP SP2) saying
"active content is blocked" etc. However, similar useage of the same
document.referrer function in another page I have seen is OK. What is
wrong? The behaviour is the same if the <scripttag contains
"JavaScript", or not.
It is because you are testing locally. Either set IE to allow Active
Content in the PC Zone or use the Mark Of The Web.
Also, if I have a link to the page containing the code above on a
webpage (say "C:\Trev\refer1.htm"),
then the referrer is given as "C:\Trev", and not the actual webpage
referrer. Why?
Because document.referrer doesn't work properly in IE when opening a
local page. Test it from a server.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 17 '06 #2
Thanks.

Is there any way to stop the "Active content blocked window" on
computers over whom I have no control? Its just that I've seen two
implementations of the referrer code; one produces the drop-down
windown and one doesn't.

Oct 17 '06 #3
Trev said the following on 10/17/2006 6:47 AM:
Thanks.

Is there any way to stop the "Active content blocked window" on
computers over whom I have no control?
Think about what you are asking there. Basically you are asking "Can I
control the settings on a computer that I have no control over?" And the
answer is, obviously, no. If people are seeing that message from a
website, then the PC is set to give that security warning. If they are
seeing it from a local file, then search the archives for "Mark of the Web".

Its just that I've seen two implementations of the referrer code;
one produces the drop-down windown and one doesn't.
Whats the code that doesn't produce the drop-down?
P.S. It isn't the use of document.referrer that causes that menu, it is
any script element in the page (even an empty script block). Test it:

<script type="text/javascript">
</script>

Open it in an IE that is set to notify, and you will get that warning
from the above block, even though there is no code in it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 17 '06 #4
Ah, great thanks.

I've sent you an email (my friend prefers not to have his webpage URL
released publicly at the moment)

Oct 17 '06 #5
Theres an example of some tracker code in the html source that doesn't
trigger the blocked warning here:

http://www.nigeria.com/About_Us/Privacy/privacy.html
http://www.cs.ucl.ac.uk/staff/M.Oliveira/

- look for the bit that has "extreme-dm"

Oct 18 '06 #6
Trev said the following on 10/17/2006 7:51 AM:
Ah, great thanks.

I've sent you an email (my friend prefers not to have his webpage URL
released publicly at the moment)
This email address doesn't receive Internet mail (It only receives AOL
mail) so you tried to email me but it got bounced back to you :)

Search the archives over the last few days and find One Dumm Hikk and
the email address it uses and you can email it to me there.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 18 '06 #7
Trev said the following on 10/18/2006 5:49 AM:
Theres an example of some tracker code in the html source that doesn't
trigger the blocked warning here:

http://www.nigeria.com/About_Us/Privacy/privacy.html
http://www.cs.ucl.ac.uk/staff/M.Oliveira/

- look for the bit that has "extreme-dm"
That is because it's an Internet page and I don't have IE set to warn
me, so, no warning message.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 18 '06 #8
Hi Randy,
I've sent you an email to your other address - hopefully you got it OK
;)

With best wishes

Trev

Oct 21 '06 #9
Trev said the following on 10/21/2006 3:45 PM:
Hi Randy,
I've sent you an email to your other address - hopefully you got it OK
;)
Yes, I got it. And that security warning is dictated by user settings
and the script in the page. If IE is set to give ActiveX warnings and
not Script warnings, then you only get it with an ActiveX. There is
nothing the programmer can do to avoid it other than not using it.

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

Randy Webb wrote:
Trev said the following on 10/21/2006 3:45 PM:
Hi Randy,
I've sent you an email to your other address - hopefully you got it OK
;)

Yes, I got it. And that security warning is dictated by user settings
and the script in the page. If IE is set to give ActiveX warnings and
not Script warnings, then you only get it with an ActiveX. There is
nothing the programmer can do to avoid it other than not using it.

Thanks, mate.

Trev

Oct 26 '06 #11

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

Similar topics

2
by: Brian | last post by:
Hi All, Can someone please point me in the right direction I am having problems combining JS and ASP. What I am trying to do is store in a database using ASP the referring page of my visitors. ...
5
by: Ryann | last post by:
Hello. I had a strange entry in my referrer logs. The http-referrer reported that the user came from another site. But the file it claimed to come from a pdf file. I followed the link back and...
5
by: Stuart | last post by:
Hi We have a dynamically created javascript menu (from ASP), which is customised per user (Have already taken all the static code out into separate cached .js file) The size of the 'dynamic'...
11
by: Rod Hilton | last post by:
Hey everyone, Does anyone know if it's possible to spoof a referral using Javascript - as in, when I go from web site A to web site B, if B uses php or javascript or something to see the...
1
by: Jeff Mowatt | last post by:
Hi all, A few months ago I was creating a small amount of revenue for a charitable effort from a referral program. Back in August it stopped producing results and only recently I began looking...
2
by: Dominique Vermeersch | last post by:
I try to do the following: <script> <!-- function getStats() { nav = navigator.appName; c = 0; if (nav != "Netscape") {
16
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I protect my javascript code? ----------------------------------------------------------------------- ...
23
by: WebFoot | last post by:
Is there a reliable way for a webpage to either break out or refuse to display when a hostile website puts it in a frame? I know about the JavaScript solution, but not all visitors have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.