我用如下脚本,在PC上使用没有问题,但是使用手机访问时,不起作用(浏览器为Oprea),该如何解决
onclick="window.external.addFavorite.......
------解决方案--------------------------------------------------------
不同的浏览器做法不同
参见
<script type="text/javascript">
// < ![CDATA[
function bookmark(){
var title=document.title;
var url=document.location.href;
if (window.sidebar){//firefox
window.sidebar.addPanel(title, url,"");
}else if(window.opera){//opera
var mbm = document.createElement('a');
mbm.setAttribute('rel','sidebar');
mbm.setAttribute('href',url);
mbm.setAttribute('title',title);
mbm.click();
}else if(window.external){//ie
window.external.AddFavorite(url, title);
}else{
alert('Unfortunately, your browser does not support this action,please bookmark this page manually by pressing Ctrl + D on PC or Cmd + D on Mac.');
}
}
// ]]>
</script>