5

I was wondering whether it is possible to redirect a user to their homepage. By homepage I mean the URL defined in their browser as homepage. The one they get to when they click the 'Home' button of the browser.

I know that Internet Explorer uses <a href="about:home" title"Go to your homepage">Homepage</a> but I have no idea what other browsers use for this!

Is this possible?

typeoneerror
  • 55,990
  • 32
  • 132
  • 223
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
  • I don't think this is possible – Pekka Aug 15 '12 at 08:54
  • Why would you want to do this? – Delorean Aug 15 '12 at 08:59
  • @XToro: You've probably heard of the Cookie Law, right? Well, I want to give a notification that my website uses cookies and when a user clicks that he or she does not agree, he will be redirected to his home page. – Bram Vanroy Aug 15 '12 at 09:01
  • 1
    Does anyone actually USE a home page in a browser? - I would suggest just going back where they came from. – Kimvais Aug 15 '12 at 09:02
  • 1
    I am not sure that it may reduce user's concerns about privacy. In case user does not agree with your privacy policy, just provide an option to get back to the previous web-site. –  Aug 15 '12 at 09:04
  • possible duplicate of [Sending user to their browser's Home Page using Javascript](http://stackoverflow.com/questions/1369450/sending-user-to-their-browsers-home-page-using-javascript) – DVK Aug 15 '12 at 09:07
  • Maybe you guys are right. Going back might be a better option. But I'll accept Haris' answer because he answered the actual question. Thanks for the comments though! – Bram Vanroy Aug 15 '12 at 09:08

2 Answers2

1

Just make a link to go back where the user came from:

<a href="#" onClick="history.go(-1);return true;">Back</a>

Or a similar button

<button type="button" onClick="history.go(-1): return true:">I do not agree</button>
Kimvais
  • 38,306
  • 16
  • 108
  • 142
  • What if they didn't just come from their homepage? – El Ronnoco Aug 15 '12 at 09:07
  • @ElRonnoco: If they didn't come from their homepage, why on earth would they want to go there? – Kimvais Aug 15 '12 at 09:18
  • @kimvais Agreed - But why would they want their browser to decide which page they were going to at all? (I'm not having a go at you btw, I think it's a bit of a silly requirement...) – El Ronnoco Aug 15 '12 at 09:24
1

I dont know if you are looking for something like this discussed in this thread:

Sending user to their browser's Home Page using Javascript

Community
  • 1
  • 1
Haris
  • 915
  • 1
  • 11
  • 28