function AddToFavorites() { var title = document.title; var url = location.href; if (window.sidebar) // Firefox window.sidebar.addPanel(title, url, ''); else if(window.opera && window.print) // Opera { var elem = document.createElement('a'); elem.…
javascript添加到收藏夹写法 <pre>function addFavorite2() { var url = window.location; var title = document.title; var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("360se") > -1) { alert("由于360浏览器功能限制,请按 Ctrl+D 手动收藏!"); } else…
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ…
我们介绍一个可兼容所有浏览器的加入收藏代码代码,大概原理是这样的我们根据获取用户navigator.userAgent.toLowerCase()信息来判断浏览器,根据浏览器是否支持加入收藏js命令,如果可以自动收藏否则就提示ctrl+D手动收藏了. function addFavorite2() { var url = window.location; var title = document.title; var ua = navigator.userAgent.toLowerCase();…