none
Is there a way to add a button to create a bookmark? RRS feed

  • Question

  • I want to put a button on a SharePoint page that when the user clicks it, it creates a bookmark (with a specific bookmark NAME) for the page.  I don't know if the answer would be code (java/jQuery?) or not, but I think it is POSSIBLE, I'm just wondering if someone out there knows how to do this?  (Help)​

    Just to be clear, I am not looking to add a url to the page, I'm looking for a button that creates a bookmark for the user within the user's "favorites".... would love it if it added it to their favorites bar, too.

    Thursday, May 14, 2015 4:34 PM

Answers

  • Hi Soupi,

    As my understanding, you want to add a button on a SharePoint page to add the page into user's favorites.

    You can add a Content Editor web part into the page, then add the following jQuery code to the HTML source of the web part:

    <button id="bookmarkme" type="button">bookmark me!</button> 
    
    <script src="http://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(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>

    A similar post for your reference:

    http://stackoverflow.com/questions/10033215/how-do-i-add-an-add-to-favorites-button-or-link-on-my-website

    Thanks,

    Wendy


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    Friday, May 15, 2015 7:36 AM
    Moderator