views:

579

answers:

2

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?

EDIT

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.");
    }
}
</script>

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

I'd just pull the "Add Bookmark" link off the site. Users know how to do that if they really want to.

Joel Coehoorn
Not exactly a helpful answer... It's often not obvious how bookmarks will behave with complex web applications, so most users are hesitant about bookmarking pages. I want to use this functionality to make it clear which pages are bookmarkable, and provide an easy way to do so.
Adam N
I would argue the reverse: that users often sort bookmarks into categories, and this will break their sort.
Joel Coehoorn
Again, not exactly a helpful answer (in fact actively misleading), because the feature (when it's not disabled) pops up a dialog asking where you'd like to put the bookmark.Please post factual answers, not opinions on functionality.
Adam N
+1  A: 

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.

scunliffe
Ah, I finally figured it out, and you were right... The Problem I was running into was that I had switch the location and title arguments, which was throwing a permission denied error.
Adam N