By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,559 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,559 IT Pros & Developers. It's quick & easy.

Help with javascript add bookmark firefox mozilla safari opera

P: 3
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.
Feb 1 '07 #1
Share this Question
Share on Google+
17 Replies


P: 3
Here is the code.


Expand|Select|Wrap|Line Numbers
  1. <td width="60"><div align="right"><a href="javascript:window.external.AddFavorite(location.href, document.title);"><img src="http://bytes.com/images/BookMarkus.gif"></div>
Feb 1 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Welcome to The Scripts.

I'm afraid this is only possible in IE, and with the following code in Firefox/Netscape?
Expand|Select|Wrap|Line Numbers
  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.
Feb 2 '07 #3

P: 23
Welcome to The Scripts.

I'm afraid this is only possible in IE, and with the following code in Firefox/Netscape?
Expand|Select|Wrap|Line Numbers
  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.
Feb 2 '07 #4

acoder
Expert Mod 15k+
P: 16,027
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.
Feb 2 '07 #5

P: 3
Thanks fellas I really appreciate the help. I am going to try that and I will get back to ya. Thanks again!
Feb 2 '07 #6

P: 4
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


Expand|Select|Wrap|Line Numbers
  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.  }
May 18 '07 #7

P: 1
Expand|Select|Wrap|Line Numbers
  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. }
Jun 25 '07 #8

P: 1
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?
Jul 4 '07 #9

P: 1
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
Oct 23 '07 #10

acoder
Expert Mod 15k+
P: 16,027
DUCMANs, welcome to TSDN!
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.
Oct 24 '07 #11

P: 1
tqd
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/...okmark-script/

You do have to pay for it for commercial sites.
Mar 6 '08 #12

acoder
Expert Mod 15k+
P: 16,027
All it does is alert that you have to press Ctrl-D, Ctrl-T, etc.
Mar 6 '08 #13

secmazec
P: 34
It is a common bug by Mozilla Firefox, I recommend using something like this, before it is fixed:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript"><!--
  2.  // Copyright http://search-megaupload.com
  3. function bookmarksite(title,url){
  4. if (window.sidebar) // firefox
  5.     //window.sidebar.addPanel(title, url, ""); Dont use until it's fixed
  6.     alert('Dear Firefox user, please press CTRL+D to Bookmark this page!');
  7. else if(window.opera && window.print){ // opera
  8.     var elem = document.createElement('a');
  9.     elem.setAttribute('href',url);
  10.     elem.setAttribute('title',title);
  11.     elem.setAttribute('rel','sidebar');
  12.     elem.click();
  13. else if(document.all)// ie
  14.     window.external.AddFavorite(url, title);
  15. }
  16. // --></script>
  17.  
EXAMPLE:

http://search-megaupload.com/
Mar 19 '09 #14

secmazec
P: 34
Hello, this is the code I use on my sites atm. It is ready to use the Firefox bookmark function when Mozilla fixes it. (just comment alert line and uncomment one above when they do so):

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript"><!--
  2. // All browser bookmark script
  3. function bookmarksite(title,url){
  4. if (window.sidebar) // firefox
  5.     //window.sidebar.addPanel(title, url, ""); Dont use until it's fixed
  6.     alert('Dear Firefox user, please press CTRL+D to Bookmark this page!');
  7. else if(window.opera && window.print){ // opera
  8.     var elem = document.createElement('a');
  9.     elem.setAttribute('href',url);
  10.     elem.setAttribute('title',title);
  11.     elem.setAttribute('rel','sidebar');
  12.     elem.click();
  13. else if(document.all)// ie
  14.     window.external.AddFavorite(url, title);
  15. }
  16. // --></script>
  17.  
Mar 20 '09 #15

acoder
Expert Mod 15k+
P: 16,027
For Firefox 3, you can use Places for bookmarks (with appropriate permissions).

In your code, when using window.external, use window.external as a check for support, not document.all because not all browsers which support document.all support the window.external interface.
Mar 31 '09 #16

P: 1
hi all..
i have code to post to all my group at once in facebook, but i can't insert files just text.. can any body help me plz by java
script code to do that??

thanx alot
Feb 21 '14 #17

P: 1
The code suggested for adding bookmark in firefox and IE, does not work for firefox v.23 and above and IE9 and above respectively. Is there alternate JS to add bookmark for the specified versions?
Apr 9 '14 #18

Post your reply

Sign in to post your reply or Sign up for a free account.