473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Help with javascript add bookmark firefox mozilla safari opera

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
17 58452
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
16,027 Expert Mod 8TB
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
senaka
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
16,027 Expert Mod 8TB
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
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
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
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
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
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
16,027 Expert Mod 8TB
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
tqd
1
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
16,027 Expert Mod 8TB
All it does is alert that you have to press Ctrl-D, Ctrl-T, etc.
Mar 6 '08 #13
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
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
16,027 Expert Mod 8TB
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
jwan
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
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

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

Similar topics

3
by: Java script Dude | last post by:
I have still yet to see a JavaScript Editor that comes close to reading a good JS book, learing it and using it with a text editor. Anyway, here my recipe for build successfull DHTML...
6
by: Timo | last post by:
I don't know enough about the technology yet to know whether this is a ridiculous question-- but is there no cross-browser javascript implementation of XMLHTTP and SOAP for use in calling web...
5
by: David Given | last post by:
I have a big, complicated Javascript program that's doing some rather complex things. One of the things it really has to do is to wait for the browser to load something. Because Javascript is...
2
by: Alan Searle | last post by:
I would like to use an XSL/HTML template to sort XML data dynamically on the client side. As it is, I found a tutorial showing how to do this on the following site ... ...
17
by: Me | last post by:
Hello, I have read all the reason why DOM purists don't like document.write and innerHTML. I would like to be a good programmer and do the right thing and not use them. But I need your help to...
3
by: Arodicus | last post by:
This is bugging me: how do I reference the topmost node (HTML) within a document? I'd like to set a class on it, which specifies various browser/os/versions so that several...
5
by: IndependentDreams | last post by:
This is a java script code that will make it snow on your page. My problem is that it works just fine in IE and Opera, but doesn't work in Fire Fox or Safari. Here is the code. If you have any idea...
8
by: Tim Nash (aka TMN) | last post by:
Hi Can anyone help me match this div below - my regex does not work - if you could tell me why I would appreciate it. var aStr = "<div class='feedflare'>dfgdg dg</div>"; var reg = new...
2
by: joelkeepup | last post by:
Hi, I made a change this morning and now im getting an error that says either "a is undefined or null" or "e is undefined or null" the microsoft ajax line is below, I have no idea how to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.