Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Help with javascript add bookmark "firefox mozzila safari"

Question posted by: peckerwoodpimpn (Newbie) on February 1st, 2007 10:16 PM
I have a javascript that add's site to favortites. It works fine in IE7 but not in anything else. This is for a clients site who uses Mac and whats it to work in all browsers. If anyone could help me out I would really appreciate it. The website is http://arizona.uofinfo.com/uofinfo/index.php. If you need the code let me know and I will post it. Thanks a million.
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
peckerwoodpimpn's Avatar
peckerwoodpimpn
Newbie
3 Posts
February 1st, 2007
10:44 PM
#2

Re: Help with javascript add bookmark "firefox mozzila safari"
Here is the code.


Code: ( text )
  1. <td width="60"><div align="right"><a href="javascript:window.external.AddFavorite(location.hr  ef, document.title);"><img src="images/BookMarkus.gif"></div>

Last edited by gits : October 23rd, 2007 at 06:15 PM. Reason: added code tags
Reply
acoder's Avatar
acoder
Site Moderator
10,970 Posts
February 2nd, 2007
10:25 AM
#3

Re: Help with javascript add bookmark "firefox mozzila safari"
Welcome to The Scripts.

I'm afraid this is only possible in IE, and with the following code in Firefox/Netscape?
Code: ( text )
  1. window.sidebar.addPanel(title, url, "")


See this link for a neat version which checks if it's IE, otherwise it displays a message to press Ctrl-D (Ctrl-T on Opera). Combine that with the above by checking for window.sidebar then adding the code snippet.

Hope that helps.

Reply
senaka's Avatar
senaka
Newbie
25 Posts
February 2nd, 2007
04:38 PM
#4

Re: Help with javascript add bookmark "firefox mozzila safari"
Quote:
Originally Posted by acoder
Welcome to The Scripts.

I'm afraid this is only possible in IE, and with the following code in Firefox/Netscape?
Code: ( text )
  1. window.sidebar.addPanel(title, url, "")


See this link for a neat version which checks if it's IE, otherwise it displays a message to press Ctrl-D (Ctrl-T on Opera). Combine that with the above by checking for window.sidebar then adding the code snippet.

Hope that helps.


Please note that the above script works fine in FireFox. But in netscape, your bookmark will be appearing in the panel. Which might not be what you want. Try the ctrl-D alternative in netscape.

Reply
acoder's Avatar
acoder
Site Moderator
10,970 Posts
February 2nd, 2007
05:05 PM
#5

Re: Help with javascript add bookmark "firefox mozzila safari"
That's why a put a question mark after Netscape (should've put it in brackets to make it stand out). Wasn't too sure about Netscape. Thanks for that info.

Reply
peckerwoodpimpn's Avatar
peckerwoodpimpn
Newbie
3 Posts
February 2nd, 2007
10:50 PM
#6

Re: Help with javascript add bookmark "firefox mozzila safari"
Thanks fellas I really appreciate the help. I am going to try that and I will get back to ya. Thanks again!

Reply
stinkysGTI's Avatar
stinkysGTI
Newbie
4 Posts
May 18th, 2007
05:20 PM
#7

Re: Help with javascript add bookmark "firefox mozzila safari"
I know this is a few months late, but I came across this post looking how to add a bookmark in Safari. Haven't found it yet, but here's a really useful script I found. It works for IE Win/Mac and Firefox Win/Mac - even Opera


Code: ( text )
  1. function CreateBookmarkLink() {
  2.  
  3.  title = document.title;
  4.  url = window.location.href;
  5.  
  6.     if (window.sidebar) { // Mozilla Firefox Bookmark
  7.         window.sidebar.addPanel(title, url,"");
  8.     } else if( window.external ) { // IE Favorite
  9.         window.external.AddFavorite( url, title); }
  10.     else if(window.opera && window.print) { // Opera Hotlist
  11.         return true; }
  12.  }

Last edited by gits : October 23rd, 2007 at 06:16 PM. Reason: added code tags
Reply
valenteen's Avatar
valenteen
Newbie
1 Posts
June 25th, 2007
08:10 AM
#8

Re: Help with javascript add bookmark "firefox mozzila safari"
Code: ( text )
  1. function addBookmark(title, url){
  2.   if(window.sidebar){ // Firefox
  3.     window.sidebar.addPanel(title, url,'');
  4.   }else if(window.opera){ //Opera
  5.     var a = document.createElement("A");
  6.     a.rel = "sidebar";
  7.     a.target = "_search";
  8.     a.title = title;
  9.     a.href = url;
  10.     a.click();
  11.   } else if(document.all){ //IE
  12.     window.external.AddFavorite(url, title);
  13.   }
  14. }

Reply
robbo23's Avatar
robbo23
Newbie
1 Posts
July 4th, 2007
03:55 PM
#9

Re: Help with javascript add bookmark "firefox mozzila safari"
This code works really well in Firefox with one exception: once you have bookmarked the site, when you select the site from your bookmarks it opens up in the sidebar rather than the main window.

Has anyone found a solution to this?

Reply
DUCMANs's Avatar
DUCMANs
Newbie
1 Posts
October 23rd, 2007
06:10 PM
#10

Re: Help with javascript add bookmark "firefox mozzila safari"
Quote:
Originally Posted by robbo23
This code works really well in Firefox with one exception: once you have bookmarked the site, when you select the site from your bookmarks it opens up in the sidebar rather than the main window.

Has anyone found a solution to this?


Hi, did you find a solution yet ?

There is a checkbox in the bookmark called "Load this bookmark in the sidebar". Uncheck it and your problem is solved. Question is how to do that using Javascript....

Regards, DUCMANs

Reply
acoder's Avatar
acoder
Site Moderator
10,970 Posts
October 24th, 2007
08:41 AM
#11

Re: Help with javascript add bookmark "firefox mozzila safari"
DUCMANs, welcome to TSDN!
Quote:
Originally Posted by DUCMANs
There is a checkbox in the bookmark called "Load this bookmark in the sidebar". Uncheck it and your problem is solved. Question is how to do that using Javascript....

I'm not entirely sure, but I don't think that would be possible in JavaScript. Maybe you could just inform the user, but then that would probably defeat the purpose of an add bookmark link.

Reply
tqd's Avatar
tqd
Newbie
1 Posts
March 6th, 2008
04:39 AM
#12

Re: Help with javascript add bookmark "firefox mozzila safari"
I have found this site that offers up a JS file that seems to cover all the browsers, and doesn't open the new bookmark in the sidebar: http://www.dynamicsitesolutions.com...ookmark-script/

You do have to pay for it for commercial sites.

Reply
acoder's Avatar
acoder
Site Moderator
10,970 Posts
March 6th, 2008
10:39 AM
#13

Re: Help with javascript add bookmark "firefox mozzila safari"
All it does is alert that you have to press Ctrl-D, Ctrl-T, etc.

Reply
Reply
Not the answer you were looking for? Post your question . . .
183,906 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Javascript / DHTML / Ajax Forum Contributors