Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is this possible to bookmark a page with html button?

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>

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.

like image 688
Jasjeet Singh Avatar asked Jul 31 '17 12:07

Jasjeet Singh


People also ask

How do I create a bookmark button in HTML?

To create a bookmark link in HTML, you need to create a bookmark using the <a> tag name attribute. Now, add a link to the bookmark. Bookmarks are also known as named anchors. This is quite useful to take readers to a specific section of the web page.

How do you link a bookmark in HTML?

Creating bookmarks in HTML is a two-step process. Here are the steps to follow: Set a bookmark using the id attribute of the HTML tags, such as <h2> , <p> , and so on. Link the HTML tag created, using an anchor tag, <a> , and the href attribute.

Which HTML tag is used to create a bookmark?

Enter <a href="#TopBookmark">Back to Top</a> to create a text link to the bookmark. Verify that the exact bookmark name follows the “#” sign. Use any text for the link; simply insert it within the “a href” tag.

How do I link a button to another page in HTML?

To create a button link to another page in HTML,just add <a> tag and wrap it around the simple Html button. Inside a <a> tag simply use href=“” attribute to give the path of the desired page. The output shows that, after clicking the “Click” button, you will be navigated to “Google” instantly.

How do I create a bookmark link?

Open Google Chrome ( ). Type your login URL into the address bar at the top of your browser window, then press Enter on your keyboard. Once the login page loads, click on the star icon in the top right of the address bar. Give the bookmark a name, and select a location where you would like the bookmark saved.


2 Answers

$(function() {
  $('#bookmarkme').click(function() {
    if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark
      window.sidebar.addPanel(document.title, window.location.href, '');
    } else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite
      window.external.AddFavorite(location.href, document.title);
    } else if (window.opera && window.print) { // Opera Hotlist
      this.title = document.title;
      return true;
    } else { // webkit - safari/chrome
      alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
    }
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<a id="bookmarkme" href="#" rel="sidebar" title="bookmark this page">Bookmark This Page</a>
like image 172
Dhaarani Avatar answered Nov 08 '22 08:11

Dhaarani


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;
    }
  });
like image 3
RAUSHAN KUMAR Avatar answered Nov 08 '22 07:11

RAUSHAN KUMAR