0

I want to make a hyperlink for my website to set the browser homepage... someone told me the following code is useful, but it didn't work for me:

<a HREF onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.example.com');">
    <img src="house.gif">
    Click here to make us your Home Page
</a>
Oriol
  • 274,082
  • 63
  • 437
  • 513
  • possible duplicate of [universal javascript for set homepage functionality](http://stackoverflow.com/questions/3075409/universal-javascript-for-set-homepage-functionality) – Josh Crozier Nov 02 '13 at 21:51
  • 2
    This isn't something that is supported now by most of the browsers, i think only IE can do this, and I'm not sure if it is still functional. – AbdelElrafa Nov 02 '13 at 21:52
  • possible duplicate of [How can I set default homepage in FF and Chrome via javascript?](http://stackoverflow.com/questions/946189/how-can-i-set-default-homepage-in-ff-and-chrome-via-javascript) – Matthew Strawbridge Nov 02 '13 at 21:55
  • Changing the homepage is generally considered a very annoying thing to do – Oriol Nov 02 '13 at 21:55
  • Don't do that. It's really annoying and nobody will use it. – Moob Nov 02 '13 at 21:56

2 Answers2

2

It is not possible with modern browsers, as it is considered as great security risk. setHomePage() javascript function have been removed few years ago.

Consider the case, that you click on some link, and it sets your homepage to some fake google page (for example one L is 1). Every time you think you are using a google, you may get some prepared results, in the best case - made to earn money from ads. But it may be much worse, a fake mail or bank site... or simply some porn site. Doesn't matter. It is dangerous.

Flash Thunder
  • 11,672
  • 8
  • 47
  • 91
-1

If you don't want the small image to be on your website use this html code and where it says http://example.com <-- You need to use your website here

<a HREF onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.example.com');">
    Make as homepage
</a>
CDspace
  • 2,639
  • 18
  • 30
  • 36