How to tell if a home page.

M

Mike.Duffy

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.
 
R

Randy Webb

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top