开发者

asp.net function to make my website as default page

开发者 https://www.devze.com 2023-02-26 18:37 出处:网络
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 u

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('&lt;a href="javascript:history.go(0);" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://mysite.com\');"&gt;');
                                document.write('&lt;strong&gt;Click Here to make this your homepage&lt;/strong&gt;');
                            </script>

As Oded mentions, this is "IE-specific".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号