读书人

从”设牵头页“浅谈window.external(p

发布时间: 2012-09-05 15:19:35 作者: rapoo

从”设为首页“浅谈window.external(ps各大网站首页处理的方式)

最近觉得还是谈一个老话题--------页面中调用window.external象的一些api进行例如“加入收藏”或者“设为主页”等操作

?

其实如果你够留意官方文档的话,你会发现这样一句话:

?

Allows access to an additional object model provided by host applications of the Windows Internet Explorer components.

?

所以就存在一个很大的问题-------兼容性?当然你能在各种社区里面看到兼容ff的设为首页或者加入收藏的代码。当然还有一些很“牛X”的网站你一打开就给你谈加入收藏夹和各种植入的广告。。。oh。。。。。头疼关之。

?

?

先认识一下window.external官方提高的文档中包含的部分methods
    AddChannel
?? ? --------------Obsolete.Presents a dialog box that enables the user add the specified channel,or to change the channel URL,if it is already installed
?? ? 2. AddFavorite?
?? ? --------------Prompts the user with a dialog box to add the specified URL to the Favorites list
       isIE=n.userAgent.indexOf("MSIE")!=-1&&!window.opera,sh=d.getElementById("sh");  //sh为a标签的idif(isIE&&sh&&!sh.isHomePage("http://www.baidu.com")){  sh.style.display="inline"  }

读书人网 >Web前端

热点推荐