Javascript – way to request permission in IE to use window.external.AddFavorite


The JavaScript security settings on Internet Explorer for my customers disallow using window.external.AddFavorite, and it generates (best case) an error in the status bar when the users click the "Add Bookmark" link on my website. Is there a way to explicitly request permission to use the window.external.AddFavorite method from the user in Internet Explorer, when the security settings don't allow use of the rest of the window.external methods?


Here's the code I'm working with:

<script type="text/javascript">
function addToFavorites() { 
    if (window.sidebar) { // Mozilla uses sidebar 
        window.sidebar.addPanel( document.title, window.location , "");
    } else if (window.external) { // IE uses window.external
        window.external.AddFavorite( window.location, document.title );
    } else { // Who knows ?  Only have to support IE & Moz anyhow.
        alert("Sorry! Your browser doesn't support this function.");

<a href="javascript:addToFavorites()">Bookmark This Page</a>

Best Solution

It will work, but it HAS to be triggered by a user driven event. (e.g. the onclick of a link/button)

This is to stop spam/adware/pr0n sites from auto stuffing your bookmarks with garbage.