|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Hi,
I'm pretty much a total newbie when it comes to javascript, but I'm hoping some kindly person out there could please help me with a problem. I have a page on my website which is being linked to directly from domains other than mine. Therefore I want to restrict access to this page unless the visitor has accessed the page from my own domain. For example: "http://www.example.com/test.html" should only be viewable when the referrer is either "http://www.example.com/menu.html" or "http://www.example.com/menu2.html". I found the perfect script that I want to utilise: <script language="javascript"> var allowedreferrer = new Array("http://www.example.com/menu.html","http://www.example.com/menu2.html"); if (document.referrer.indexOf(allowedreferrer) == -1) { alert("You can only access this page from http://www.example.com"); window.location="http://www.example.com"; } </script> The problem is that my "test.html" page opens via a javascript pop-up window when a link is clicked in "menu.html" or in "menu2.html", and I don't know how to pass the referrer information into this pop-up. Is this possisble to do via javascript somehow on the client side? If anyone can please help me I'd really appreciate it. Thanks so much in advance, Kate. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Help for a Total Newbie! Referrer Info in Pop-Up Window Needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|