hyperlink to default homepage?

taff's picture

They have: 956 posts

Joined: Jun 2001

Is this possible in a crossbrowser friendly way? what I need is an inpage hyperlink to take the user to their browser's default home page. Actually, I'll probably have the link got to a redirect page which takes the user to their home page if that makes a difference.

.....

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey taff - the code on this page worked for mme in N4.7 and IE5.5, but I get the alert in N6

Confused

Busy's picture

He has: 6,151 posts

Joined: May 2001

just curious why you would want it going to users homepage, I dont know about anyone else but I use blank for mine, loads fast, no errors, as color you want as long as its white Smiling

taff's picture

They have: 956 posts

Joined: Jun 2001

I was wondering if someone might ask that. My next questions will be about non-caching pages and the easiest way to wipe out site visits from history.

No, not going into the adult site biz.

Actually I'm developing a site for a domestic violence crisis center and one of their concerns is someone being caught visiting the site by an abuser. Each page will have a "panic button" to get them out quickly.

.....

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

If it is a panic button, why not make it just another site like yahoo, goggle, MSNBC, CNN. It would be much easier to code.

taff's picture

They have: 956 posts

Joined: Jun 2001

Mairving: That is plan B. I just thought that the default home page would be a little safer than some site that might be deemed "out of character" for the user.

.....

They have: 117 posts

Joined: Feb 2002

I swiped bits and pieces of this and that and it seems to work. Probably needs some more testing though...

Panic Button
<script>
function gohome()
{
if (navigator.appName=="Netscape")
window.home()
else if (document.all)
window.location="about:home"
else
alert("You need NS 4+ or IE 4+ to go back home!")
}
</script>

They have: 601 posts

Joined: Nov 2001

Yeah. I also saw this code floating around on the web, too:

&lt;script&gt;
function gohome(){
        if((navigator.appVersion.indexOf("4.") != -1) && (navigator.appName.indexOf("Netscape") != -1)){
        home();}
}
&lt;/script&gt;


<form><input type="button" value="Home" onClick="home();"></form>
'

- wil

They have: 117 posts

Joined: Feb 2002

I think -- considering your scenario -- I would add a document.open() to that to wipe out the current page in case there was some lag in loading the home page.

taff's picture

They have: 956 posts

Joined: Jun 2001

Thanks guys, I'll test these out and let you know.

doublehelix: I was thinking of having the link actually go to a benign and quick loading redirect page first. This would hopefully minimalize the problem you refer to as well as add a bit of a buffer/deterrent to the back button of the browser.

.....

taff's picture

They have: 956 posts

Joined: Jun 2001

Belated followup:

doublehelix's code works like a charm. Thanks a million!

They have: 48 posts

Joined: May 2002

Hi Taff,

I'm puzzled - why wouldn't users just use the browser Home button? Any link you put in is likely to be off-screen some of the time, so teaching them about the Home button sounds safer to me.

Mike

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.