js add to favorites and some tricks

Add to Favorites

<script type="text/javascript">
function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败,有劳您手动添加。");
        }
    }
}
</script>
<a href="JavaScript:window.external.AddFavorite('https://blog.csdn.net/gqzydh','Page')"> <font color="white">
添加到收藏夹 </FONT> </a>

Open the web page and pop up the set as home page dialog code

<a href=# onClick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’
htto;//www.csdn.net’);">设为主页</a>

When closing the webpage, pop up the set as home page dialog code

<BODY id=iehomepage 
onunload="iehomepage.style.behavior=’url(#default#homepage)’;if(!(iehomepage.isHomePage(’htto;//www.csdn.net’)))iehomepage.setHomePage(’htto;//www.csdn.net’);">

Mouse over to set as home page

<a href=# onMouseOver="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’htto;//www.csdn.net’);">设为主页</a>

pop up when the page loads

<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/ 
</script> 
<body onload="bookmarkit()">

Pop up when leaving the page

<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}</script> 
<body onunload="bookmarkit()">

right pop up

<script language=javascript1.2> 
document.all.onMouseDown=new Function("if (event.button==2||event.button==3)
window.external.addFavorite(’htto;//www.csdn.net’,'CSDN 博客')")/ 
</script>

Click the text to pop up

<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'CSDN 博客')}/ 
if (document.all)document.write(’<a href="#" onClick="bookmarkit()">加入收藏夹</a>’) 
</script>

Mouse over text pops up

<script language="javascript"> 
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'CSDN 博客')}/ 
if (document.all)document.write(’<a href="#" onMouseOver="bookmarkit()">加入收藏夹</a>’)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324661256&siteId=291194637