在html中怎么用 js收藏网页到收藏夹

html-css08

在html中怎么用 js收藏网页到收藏夹,第1张

需要准备的材料分别有:电脑、html编辑器、浏览器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<script>标签,输入js代码:window.external.addFavorite(location.href, '我的网站')。

3、浏览器运行index.html页面,此时会弹出添加到收藏夹的面板,点击完成即可。

把以下代码放在<head></head>间。

<script type="text/javascript">

function addBookmark(title,url) {

if (window.sidebar) {

window.sidebar.addPanel(title, url,"")

} else if( document.all ) {

window.external.AddFavorite( url, title)

} else if( window.opera &&window.print ) {

return true

}

}

</script>

以下代码放在:<body></body>间

<a href=javascript:addBookmark('收藏我吧,'http://这里写你的网址/')> 收藏我吧</a>把.

点击工具栏右边的“中心收藏夹”图标(三横)——在收藏夹选项卡下点击“收藏夹设置”——在里面“导入”。 如果想将某个网页添加入收藏夹: 点击工具栏右边的“收藏”图标(五角星)——在“收藏”选项卡下点击“保存”。