By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

How to tell if a home page.

P: n/a
Is there a trick you can use to know if someone has made your web page his
"home"? At first, I thought to check if ( history.length == 0 ) or if (
document.referrer.href == ""). [1]

These both sort of work, but can be fooled if the browser is launched from
another application, such as an external mail reader or newsreader.

[1] = Document.referrer is always empty for local disk "file://" urls. This
method will also be fooled if someone takes the time to type in (or
cut/paste) the url directly into the address bar.
Nov 30 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Mike.Duffy said the following on 11/30/2006 3:35 PM:
Is there a trick you can use to know if someone has made your web page his
"home"?
Ask them.
At first, I thought to check if ( history.length == 0 ) or if (
document.referrer.href == ""). [1]
Those are not reliable.
These both sort of work, but can be fooled if the browser is launched from
another application, such as an external mail reader or newsreader.
Or if your homepage is set to about:blank.
[1] = Document.referrer is always empty for local disk "file://" urls. This
method will also be fooled if someone takes the time to type in (or
cut/paste) the url directly into the address bar.
My homepage for every browser I have is about:blank and the
history.length is always 1 for the first page I open no matter how I
open it so checking history.length won't tell you. It also won't tell
you if I open the page via link with a target attribute or by right
clicking and choose to open it in a new window/tab.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.