这可以用html按钮为页面添加书签吗? [英] is this possible to bookmark a page with html button?

查看:80
本文介绍了这可以用html按钮为页面添加书签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用html按钮为页面添加书签?

is this possible to bookmark a page with html button?

<button>Bookmark This page</button>

function onclickfunction(){
  alert('Press Ctrl + D to bookmark this page');
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button onclick="onclickfunction()">Bookmark this page</button>

此代码指示您如何在chrome中为页面添加书签。
,但我想打开一个对话框,我们按下谷歌浏览器完成。

this code instruct you to how to bookmark a page in chrome. but i want to open a dialog box where we press finished in google chrome.

推荐答案

使用此脚本加入书签你的网页,你可以在这里参考为网址添加书签

[原始网址现在重定向到一个劫持浏览器后退按钮的诈骗网站。
原始网址为:
http://www.developersnippets.com/2009/05/10/simple-bookmark-script-using-jquery/ ]

Use this script to bookmark your page, you can reference here bookmark a url
[Original URL now redirects to a scam website that hijacks the browser's back button.
Original URL was:
http://www.developersnippets.com/2009/05/10/simple-bookmark-script-using-jquery/]

$("button").click(function(e){
    e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
    var bookmarkUrl = "your_bookmark_url";
    var bookmarkTitle = "your_bookmark_title";

    if (window.sidebar) { // For Mozilla Firefox Bookmark
        window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
    } else if( window.external || document.all) { // For IE Favorite
        window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
    } else { // for other browsers which does not support
         alert('Your browser does not support this bookmark action');
         return false;
    }
  });

这篇关于这可以用html按钮为页面添加书签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆