asp.net function to make my website as default page
hHi,
simple and fast question:
How do I make a link in which the user will be asked if my homepage should b开发者_运维百科e his defualt page in his web browser?
This is not possible, unless you are using IE.
For IE the link would look like this:
<a target="_self" href="#" onClick="this.style.behavior='url(#default#homepage)';
this.setHomePage('http://www.yoursite.com');">Set Homepage</a>
User interaction is required for this (i.e going into the browser settings and intentionally setting it), and a good thing too, otherwise any link could reset my homepage.
See this SO question and answers.
<script Language="JavaScript">
document.write('<a href="javascript:history.go(0);" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://mysite.com\');">');
document.write('<strong>Click Here to make this your homepage</strong>');
</script>
As Oded mentions, this is "IE-specific".
精彩评论