970_90

Thursday, 26 November 2015

How to bookmarks a web page with JavaScript


How to bookmarks a web page with JavaScript


Follow Simple 3 Steps.
  1. Add Following code where you want to show the Bookmark Button.
    <a href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#" id="bookmarkmarkme" rel="sidebar" title="Click to Bookmark this Page">Bookmark Me</a>
  2. Include jQuery File
    <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
  3. Add Following JavaScript code at end of page.
                            $(document).ready(function() {
                              $("#bookmarkmarkme").click(function() {
                                /* Mozilla Firefox Bookmark */
                                if ('sidebar' in window && 'addPanel' in window.sidebar) { 
                                    window.sidebar.addPanel(location.href,document.title,"");
                                } else if( [email protected]_on!@*/false) { // IE Favorite
                                    window.external.AddFavorite(location.href,document.title); 
                                } else { // webkit - safari/chrome
                                    alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
                                }
                            });
                          });
                                        



No comments:

Post a Comment