Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Losing data?

Status
Not open for further replies.

hermes1

Programmer
Oct 22, 2003
38
US
I am coming across a strange problem where i lose some referrer type data if a page is called with window.open() as opposed to just calling it as a link. Is there anything i can do to not lose this.


Probably a problem with this function
escape(document.referrer)

Thank You
 
When using window.open, refer to the "parent" with document.opener (instead of referrer).

'hope that helps.

--Dave
 
Not sure if document.refeffer has a value as far as popups are concerned. Try parent.location
 
Ok i replaced "referrer" with "opener" but it still didn't work, maybe it would be easier if i just put the code up here it is a counter script BTW.


<script language="Javascript"><!--
aw=window; aatd=aw.top.document; aasd=aw.self.document; aajs="1.0"; aan=navigator;
aar=escape(aasd.referrer); aap=escape(aw.self.location.href); aasd.cookie="ac=1";
aac=2; if(aasd.cookie) aac=1; aaf=2; if(self!=top) aaf=1;
if(aaf==1) {aafr=escape(aw.top.location.href);if(aafr==aar) aar=escape(aatd.referrer)}
else aafr=""; aant=2; if(aan.appName.substring(0,2)=="Mi") aant=1;
aad=new Date(); aalt=aad.getTimezoneOffset();
//--></script>
<script language="Javascript1.1"><!--
aajs="1.1";aaj=2;if(aan.javaEnabled()) aaj=1;
//--></script>
<script language="Javascript1.2"><!--
aajs="1.2";aas=screen;if(aant==1) aacol=aas.colorDepth; else aacol=aas.pixelDepth;
aaw=aas.width;aah=aas.height;
//--></script>
<script language="Javascript1.3"><!--
aajs="1.3";
//--></script>
<script language="Javascript"><!--
aa="<img border=0 alt='ActualAnalyzer' src='aa+="?anr=" + escape(document.referrer) + "&anp="+aap + "&anf="+aaf + "&anfr="+aafr + "&anjs="+aajs + "&anc="+aac + "&anj="+aaj;
aa+="&ancol="+aacol + "&anwt="+aaw + "&anh="+aah + "&anlt="+aalt + "'>"; aasd.write(aa);
//--></script>
 
Rather than wade through that lot I just added the below code to a popup. As I suspected, document.referrer is blank (Mozilla and IE) but parent.location works.

Code:
alert( "document.referrer = " + document.referrer + "\n\nparent.location = " + parent.location );

HTH.
 
I tried to replace document.referrer with parent.location and i am still not getting any data? I don't know what i am missing here.
 
I know you tried 'opener' already, but try it again WITHOUT the 'document' in front of it (i.e., just opener by itself). Failing that, try 'window.opener'.

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top