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

How do I create link that directs user to browser homepage?

P: 4
I've created a webpage for a wireless hotspot the requires a user to agree to some terms and conditions before it allows them internet access. After they have agreed to the terms I have a "Continue to Internet" link which currently just sends them to Google. I would rather send them to the homepage they have set in their browser preferences. For the IE uses I can just send them to about:home but I'm struggling to find a way to do it for firefox. Is their a javascipt command to mimic a homepage button click? I can't think of any reasons this would be a privacy or security issue but I might be missing something. Any suggestions would be greatly appreciated.
Jul 17 '08 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 15k+
P: 16,027
Not sure how well it's supported across browsers, but window.home() will work in Firefox.
Jul 18 '08 #2

P: 4
Thanks acoder that works great. I'm new to all this so my code probably needs to be cleaned up but for anyone interested this code seems to work for IE, firefox, and opera (at least the current versions)
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" >
  2. function sendHome(){
  3.    if(window.home!=null){
  4.       window.home();
  5.    }
  6.    else{
  7.       document.location.href = "about:home";
  8.    }
  9. }
  10. </script>
It doesn't appear to work for safari. If anyone has any ideas on safari let me know.
Jul 18 '08 #3

Expert Mod 15k+
P: 16,027
I'm not sure, but I don't think Safari has a way of directing to the home page, so you can just display an alert for it and other browsers which also do not support this non-specified feature.
Jul 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.