Java Script Problem :(
Tue, March 1, 2005 12:20 AM
I have been using a remote .js for bookmarking:
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
and it works fine with IE, but for some reason with Firefox it bookmakrks it then when clicked it loads bookmark in a sidebar?
WEIRD
Has anyone found a way around this.
Replies:
ewoods on
Tue, March 1, 2005 5:16 AM
That code won't actually work in most Mozilla based products as they use the old standard API (from Netscape days) for bookmarking, whereas IE has rebranded everything as 'Favorites' and changed the API.
You might try searching for alternate code to do it in Firefox, and use a browser detect to link the right code to the page.
Best of luck!
oyelb on
Tue, March 1, 2005 7:53 AM
---
EDIT > Posted the script without realizing it appears to be the same as the one you are using. However, I have yet to have any issues with the bookmarks in a Firefox. In Mozilla it does, however, want to add a tab to the side bar.
---
Here is a script I have used from dynamic drive and it works fine for both IE and Firefox.
---In the head tag:---
<script type="text/javascript">
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
</script>
--- Where you want the link: ---
<a href="javascript:bookmarksite(' Title of Bookmark', 'http://www.yoursiteherecom')">Click
here to bookmark
us!</a>
Hope that helps.
Tue, March 1, 2005 7:36 PM
Thanks guys