|
-
Jan 17th, 2001, 02:58 PM
#1
Thread Starter
Member
Hi,
Here is my dilemma. I need to pass the referring URL to an ASP page. Normally, I would of course use the HTTP_REFER server variable. The problem is that I am opening the ASP page via a javascript:window.open('http://blah/stuff.asp') link so that I stay on the current page but open a new window. When I do this, the HTTP_REFER variable is blank because it is a new window (at least I think that is why). The other catch is that the link that opens this window can not require any additional code on the page on which it resides. In other words, I don't want to require someone to add some javascript or vbscript code to their page for me to get their URL. I hope this makes sense. If you have any ideas, please share them!
Thanks!
Matt
-
Jan 17th, 2001, 03:15 PM
#2
Frenzied Member
what is exactly your question,
do you need do interact with bith window or....?
-
Jan 17th, 2001, 03:37 PM
#3
Thread Starter
Member
My question is:
How can I get the URL of the page a clicked link originated from?
For example:
<A HREF="javascript:window.open('http://www.somewhere.com/stuff.asp','Test')">View Page</A> would open a new window for the stuff.asp page. But since it is a new window, HTTP_REFER is blank and I need to know what website this link resided on. Remember also that this link could theoretically reside on any website. The ASP page that the link opens needs to know the referring URL. Does that help?
Thanks.
Matt
-
Jan 17th, 2001, 04:38 PM
#4
New Member
Because you are opening up a new window, you are creating a new session...just like opening up your browser for the first time. That is why the REFERRER is blank.
You can use JavaScript to determine the current URL on the page that contains the link and add that to the URL of the link when it is clicked. This is a bit tricky, cause you have to convert your link to a form since javascript doesn't give us a way to edit the link href.
Code:
<script>
function processlink() {
form1.action="http://www.somewhere.com/stuff.asp.asp?referrer=" + location.URL;
form1.submit();
}
</script>
<a href="javascript:Processlink()" name="link1">View Page</a>
<form method = post id=form1 name=form1 onSubmit="processlink();">
</form>
location.URL returns the current url to the page that we are on. This is appended as a parameter to the url that requests the stuff.asp page. Then in your stuff.asp page, you can simply get the REFERRER by:
Code:
referrer = request("referrer")
Hope that helps..
JeffB
http://www.auctionshare.com
"All men are created equal...some just work harder in the off season."
-
Jan 17th, 2001, 04:50 PM
#5
Thread Starter
Member
JeffB,
I appreciate the info. The only thing about what you suggest is that it requires the website containing the link to add Javascript to their page and I would rather not do that. Although, the more I investigate the problem, it looks like I may not have a choice if I wish to get that information.
Thanks again.
Matt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|