Forum Moderators: open

Message Too Old, No Replies

how to retrieve the host name

         

panaceapeace

1:19 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Hi

Iam novice about javascript.

other website will insert a jave script code from my site so that i will update the content to their website automatically.

Now i have a requirement, that i need to know which website are using my code.Right now my code will serve their request but dont report who is requesting.

How can i know which url is requesting my service?

TIA

Rambo Tribble

1:28 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The document object has a referrer property that contains the URL of a page that linked to the current page. Bookmarks or typing the URL into the location bar will not produce a referrer property. Also, some versions of IE do not reliably report the referrer.

Type this into your browser's location bar now for a demo:


javascript:alert(document.referrer);

kaled

2:19 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Referrer information is sent by the browser and may be switched off or even faked.

You may prefer, in the future, to arrange for urls to your site to include unique codes.
e.g.
www.yourdomain.com/page.html?unique_idcode

The unique_idcode should be allocated by you to identify each referrer.

Which system is best (or a combination of both) will depend on what sort of service you are offering and other factors.

Kaled.