Forum Moderators: open

Message Too Old, No Replies

FireFox and adding favorites with Javascript

FireFox and adding favorites with Javascript

         

Harris

4:41 am on Nov 28, 2004 (gmt 0)

10+ Year Member



I use a function to open the Add Favorite window when a "Bookmark our site" link is clicked in MSIE.

function makelink(){
if(document.all)
window.external.AddFavorite(url,title)

As far as I know, this function only works in MSIE.

Is there a similar function I can use in FireFox?

What about Opera, Netscape, and Safari, etc.?

Thank you in advance for your help!

Harris

dcrombie

1:37 pm on Nov 28, 2004 (gmt 0)



AFAIK only MSIE thinks that the website knows better than the user that they want to add a bookmark ;)

jouwpagina

3:44 pm on Nov 28, 2004 (gmt 0)

10+ Year Member



I think it will not be possible in MSIE 7 either. It's so easy to cheat with this feature.

Rambo Tribble

4:39 pm on Nov 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



However, the key combination, Ctrl+D, is pretty universal in its support.

Harris

7:02 pm on Nov 28, 2004 (gmt 0)

10+ Year Member



Thank you for your answers!

Does anyone knew for certain that MSIE 7 will not support this function?

If this is true, I will need to modify the function so it will not fail in MSIE 7.

Also, I have read that Opera uses "Control T" instead of "Control D" for adding a bookmark.

Does anyone know if this is true?

Are there any other "major" browsers that do not use "Control D"?

Thank you for your help!
Harris

Rambo Tribble

7:54 pm on Nov 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, Opera uses Ctrl+T.

dcrombie

10:20 am on Nov 29, 2004 (gmt 0)



Mac browsers use 'Apple + D' (and 'Apple + T' for Opera)

jbot

10:43 am on Nov 29, 2004 (gmt 0)

10+ Year Member



there isn't going to an MSIE7. version 6 was the last standalone browser. the next version will be even more tightly integrated into the OS (codename Longhorn), and when it comes out everything will change.

Harris

4:39 am on Nov 30, 2004 (gmt 0)

10+ Year Member



Thank you all for taking the time to answer!

Harris

tomda

6:10 am on Nov 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this ;)
It will output different text depending of the browser (IE, Opera, Mozilla and others).

[code]
script type='text/javascript'>
<!--
var IEstring = "<a href='javascript:window.external.addFavorite"
IEstring += "(location.href,document.title);' title='Add to Favorites'>Favorites<\/a>" ;
var NSstring = "Click [Ctrl + D] ";
var OPstring = "Click [Ctrl + T]";
var OTHstring = "Bookmark this page!"
var whichString = OTHstring ;
var agt = navigator.userAgent.toLowerCase();
var app = navigator.appName.toLowerCase();
var ieAgent = agt.indexOf('msie');
var nsAgent = app.indexOf('netscape');
var opAgent = app.indexOf('opera');
if (ieAgent!= -1) { whichString = IEstring; } else if (nsAgent!= -1){ whichString = NSstring; } else if (opAgent!= -1){whichString = OPstring; }
document.write(whichString)
-->
</SCRIPT>

Harris

12:24 am on Dec 4, 2004 (gmt 0)

10+ Year Member



Thank you very much!

How would you modify this so the Mac users would get "Command D" or "Command T" when they click the link?

Again, thank you very much?