Forums
This topic is locked
popup windows and HTTP_REFERER
Posted 05 Feb 2002 12:24:32
1
has voted
05 Feb 2002 12:24:32 Peter Borcherds posted:
Hi all,I'm having a problem with popup windows and HTTP_REFERER. The page I am opening has the {ServerVariables.HTTP_REFERER} command which works perfectly except when I link to it from another page using the javascript 'openWindow' command...
How can I open a popup window and still use the {ServerVariables.HTTP_REFERER} command...
If you need more clarification, please let me know...
Peter Borcherds
Paliz Design
www.palizdesign.com
Windoze ME / PWS / UD 4.01 / ASP / Access 2000
<font face='Arial'></font id='Arial'>
w. www.palizbay.com
Edited by - paliz on 02 Mar 2006 15:02:34
Replies
Replied 03 Jun 2003 12:33:01
03 Jun 2003 12:33:01 Alan Chua replied:
Hello peter,
referring to your post. I was wondering if you have already solve this problem.
I face the same problem as yours and still can't solve it yet.
Please let me know if you have already an answer.
Thanks
Regards,
Lonetree
referring to your post. I was wondering if you have already solve this problem.
I face the same problem as yours and still can't solve it yet.
Please let me know if you have already an answer.
Thanks
Regards,
Lonetree
Replied 03 Jun 2003 15:14:48
03 Jun 2003 15:14:48 Peter Borcherds replied:
Hi Lonetree,
Yes, I sorted this out a long time ago - I'll try to find the code and will post it here
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 02 Mar 2006 15:02:51
Yes, I sorted this out a long time ago - I'll try to find the code and will post it here
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 02 Mar 2006 15:02:51
Replied 03 Jun 2003 15:31:25
03 Jun 2003 15:31:25 Alan Chua replied:
Thanks Peter,
will wait for your answer.
Regards,
Lonetree
will wait for your answer.
Regards,
Lonetree
Replied 03 Jun 2003 16:01:42
03 Jun 2003 16:01:42 Peter Borcherds replied:
Here you go:
This is the popup link:
<a href="javascript<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>penInterested();">more info<a/>
This is the popup script and goes in the <head> of your main page:
<script language="JavaScript">
function openInterested() {
var x = "moreinfo.asp" + "&REFERER=" + location.href;
window.open(x,"newWin", "width=500,height=400"
;
}
</script>
and finally, this code goes on your popup page and shows the referring URL:
<%Response.Write Request("REFERER"
%>
If you want to see this in action, follow this link: www.starconsulting.co.uk/coursedetail.asp?CourseID=1231 and click on the 'more info' button - now view the source of this popup window - near the bottom of the code you will see the following:
<input type="hidden" name="URL" value="www.starconsulting.co.uk/coursedetail.asp?CourseID=1231">
The original code for this was
<input type="hidden" name="URL" value="<%Response.Write Request("REFERER"
%>">
When you click on the 'more info' link the popup code replaces the '<%Response.Write Request("REFERER"
%>' with the referring URL.
Hope this helps.
Regards,
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 03 Jun 2003 16:11:53
Edited by - paliz on 02 Mar 2006 15:03:14
This is the popup link:
<a href="javascript<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>penInterested();">more info<a/>
This is the popup script and goes in the <head> of your main page:
<script language="JavaScript">
function openInterested() {
var x = "moreinfo.asp" + "&REFERER=" + location.href;
window.open(x,"newWin", "width=500,height=400"

}
</script>
and finally, this code goes on your popup page and shows the referring URL:
<%Response.Write Request("REFERER"

If you want to see this in action, follow this link: www.starconsulting.co.uk/coursedetail.asp?CourseID=1231 and click on the 'more info' button - now view the source of this popup window - near the bottom of the code you will see the following:
<input type="hidden" name="URL" value="www.starconsulting.co.uk/coursedetail.asp?CourseID=1231">
The original code for this was
<input type="hidden" name="URL" value="<%Response.Write Request("REFERER"

When you click on the 'more info' link the popup code replaces the '<%Response.Write Request("REFERER"

Hope this helps.
Regards,
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 03 Jun 2003 16:11:53
Edited by - paliz on 02 Mar 2006 15:03:14
Replied 03 Jun 2003 16:17:13
03 Jun 2003 16:17:13 Peter Borcherds replied:
Sorry, that code with the smiley should read:
<a href="javascript: openInterested();">more info<a/>
(remove the space between the : and open)
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 02 Mar 2006 15:03:32
<a href="javascript: openInterested();">more info<a/>
(remove the space between the : and open)
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 02 Mar 2006 15:03:32
Replied 03 Jun 2003 19:41:51
03 Jun 2003 19:41:51 Alan Chua replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Sorry, that code with the smiley should read:
<a href="javascript: openInterested();">more info<a/>
(remove the space between the : and open)
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Sorry, that code with the smiley should read:
<a href="javascript: openInterested();">more info<a/>
(remove the space between the : and open)
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 03 Jun 2003 19:43:33
03 Jun 2003 19:43:33 Alan Chua replied:
Thanks Peter,
this does solve the problem a little, but I think the code you have sent me has some mistake, I edited it a little :
<script language="JavaScript">
function openInterested() {
var x = "moreinfo.asp?" + "&REFERER=" + location.href;
window.open(x,"newWin", "width=500,height=400"
;
}
</script>
or
<script language="JavaScript">
function openInterested() {
var x = "moreinfo.asp?ref=somevalue" + "&REFERER=" + location.href;
window.open(x,"newWin", "width=500,height=400"
;
}
</script>
but then, this don't really solve the issue if the popup page is to be controlled by request.servervariables("HTTP_REFERER"
. Your code in the main page merely pass a querystring to the popup page. User can actually access the page if they just refer to the browser history or simply just enter the url with the querystring value.
I hope you understand what I'm trying to say.
However, I have to thank you a zillion for rendering your help.
Thank you.
Regards,
Lonetree
P/S: do keep in touch. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
this does solve the problem a little, but I think the code you have sent me has some mistake, I edited it a little :
<script language="JavaScript">
function openInterested() {
var x = "moreinfo.asp?" + "&REFERER=" + location.href;
window.open(x,"newWin", "width=500,height=400"

}
</script>
or
<script language="JavaScript">
function openInterested() {
var x = "moreinfo.asp?ref=somevalue" + "&REFERER=" + location.href;
window.open(x,"newWin", "width=500,height=400"

}
</script>
but then, this don't really solve the issue if the popup page is to be controlled by request.servervariables("HTTP_REFERER"

I hope you understand what I'm trying to say.
However, I have to thank you a zillion for rendering your help.
Thank you.
Regards,
Lonetree
P/S: do keep in touch. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 03 Jun 2003 22:48:40
03 Jun 2003 22:48:40 Peter Borcherds replied:
Sorry, I left out a question mark (?)...
You are correct, what my code does is pass the URL of the referring page to the popup, but does not control it. It's for use with a 'Send to friend' page...
Can you explain exactly what you want to use the HTTP_REFERER for?
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 02 Mar 2006 15:04:01
You are correct, what my code does is pass the URL of the referring page to the popup, but does not control it. It's for use with a 'Send to friend' page...
Can you explain exactly what you want to use the HTTP_REFERER for?
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 02 Mar 2006 15:04:01
Replied 04 Jun 2003 03:52:17
04 Jun 2003 03:52:17 Alan Chua replied:
<font face='Trebuchet MS'></font id='Trebuchet MS'>
Hi Peter,
thanks for your reply again. Ok, what I am trying to do is actually quite simple.
1) I have 2 pages here.
page1 - contacts.html
page2 - contact_form.asp (where the emailing proccess takes place)
2) page1 will call a popup page of page2 where querystrings are passed from page1.
3) page2 will do a check on HTTP_REFERER. If it is being referred to by page1, page2 will display with all the neccessary textbox for emailing. Else if page2 is not being referred to by page1, then it will be redirected to another page or halt.
That's all I want.
The reason why I do not want users to call up page2 without referral is because:
1) there will be no querystring being passed.Hence, the email will not be sent without any valid email address.
2) secondly, I do not wish user to just enter the url with querystring of other addresses. Although, this can still be dome, if they rollover the link from page1, revealing the url and querystring, they will not be able to call out page2, if I control page2 with HTTP_REFERER.
I hope this is clear to you. Sorry for the inconvenience that might have caused to you. Thank you so much for the helps
Regards
Lonetree
Hi Peter,
thanks for your reply again. Ok, what I am trying to do is actually quite simple.
1) I have 2 pages here.
page1 - contacts.html
page2 - contact_form.asp (where the emailing proccess takes place)
2) page1 will call a popup page of page2 where querystrings are passed from page1.
3) page2 will do a check on HTTP_REFERER. If it is being referred to by page1, page2 will display with all the neccessary textbox for emailing. Else if page2 is not being referred to by page1, then it will be redirected to another page or halt.
That's all I want.
The reason why I do not want users to call up page2 without referral is because:
1) there will be no querystring being passed.Hence, the email will not be sent without any valid email address.
2) secondly, I do not wish user to just enter the url with querystring of other addresses. Although, this can still be dome, if they rollover the link from page1, revealing the url and querystring, they will not be able to call out page2, if I control page2 with HTTP_REFERER.
I hope this is clear to you. Sorry for the inconvenience that might have caused to you. Thank you so much for the helps
Regards
Lonetree
Replied 04 Jun 2003 09:37:17
04 Jun 2003 09:37:17 Peter Borcherds replied:
Hi Lonetree,
I think the easiest way would be to use an IF/ELSE statement - ie. IF HTTP_REFERER = page1URL then run Page2 script ELSE display message
I think the best place for such an IF/ELSE statement would be in the email code, as you don't want the email to be sent out unless the HTTP_REFERER URL is the correct one.
Does this make sense? Anyone else, am I on the right track here? Feel free to step in if I am far off...
Lonetree, unfortunately at the moment I do not have time to write an example script for you (too many projects, not enough time), but let me know how you go and I will see if I can help further.
Regards,
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 04 Jun 2003 09:38:08
Edited by - paliz on 02 Mar 2006 15:04:29
I think the easiest way would be to use an IF/ELSE statement - ie. IF HTTP_REFERER = page1URL then run Page2 script ELSE display message
I think the best place for such an IF/ELSE statement would be in the email code, as you don't want the email to be sent out unless the HTTP_REFERER URL is the correct one.
Does this make sense? Anyone else, am I on the right track here? Feel free to step in if I am far off...
Lonetree, unfortunately at the moment I do not have time to write an example script for you (too many projects, not enough time), but let me know how you go and I will see if I can help further.
Regards,
Peter
DWMX / IIS5.1 / Win XP Pro / VBScript / ASP / MSAccess 2000
www.palizdesign.com
Edited by - paliz on 04 Jun 2003 09:38:08
Edited by - paliz on 02 Mar 2006 15:04:29
Replied 13 Jun 2003 17:45:32
13 Jun 2003 17:45:32 Alan Chua replied:
Thank you everyone for all the suggestion, and tips.
In fact, I have sovled the problem. the popup window behaviors is not 100% right in scripting, although it does popup the targeted window, it does not has a HTTP_REFERER header. I have come across a website where explanation on this issue is discussed.
tom.me.uk/scripting/popups.asp
There is also a extension if I'm not wrong in UDZone.
www.dmxzone.com/ShowDetail.asp?NewsId=3981
Thanks everybody.
In fact, I have sovled the problem. the popup window behaviors is not 100% right in scripting, although it does popup the targeted window, it does not has a HTTP_REFERER header. I have come across a website where explanation on this issue is discussed.
tom.me.uk/scripting/popups.asp
There is also a extension if I'm not wrong in UDZone.
www.dmxzone.com/ShowDetail.asp?NewsId=3981
Thanks everybody.