Bookmark on Firefox

Discussion in 'Javascript' started by Pipp, May 5, 2007.

  1. Pipp

    Pipp Guest

    Hi, this simple code works well to add a bookmark on IE, but it
    doesn't work on Firefox
    <a href="javascript:window.external.AddFavorite('http://
    www.mysite.com','My site is cool');">

    Can someone suggest me something ?
     
    Pipp, May 5, 2007
    #1
    1. Advertising

  2. Pipp

    Mad Joe Guest

    Cross browser Bookmark

    // Firefox 1.x+, IE4+ and Opera7+

    <script type="text/javascript">
    <!-- // Begin
    function bookmarksite(title,url){
    if (window.sidebar) // Firefox
    window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print){ // Opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
    }
    else if(document.all) // IE
    window.external.AddFavorite(url, title);
    }
    // End -->
    </script>

    <a href="javascript:bookmarksite('Page Title',
    'http://www.example.com')">Bookmark this site!</a>


    Pipp wrote:
    > Hi, this simple code works well to add a bookmark on IE, but it
    > doesn't work on Firefox
    > <a href="javascript:window.external.AddFavorite('http://
    > www.mysite.com','My site is cool');">
    >
    > Can someone suggest me something ?
    >
     
    Mad Joe, May 5, 2007
    #2
    1. Advertising

  3. Pipp

    Pipp Guest

    Re: Cross browser Bookmark

    On Firefox this opens the bookmark on the sidebar, how to open it on
    the main window ?

    On 5 Mag, 21:36, Mad Joe <> wrote:
    > // Firefox 1.x+, IE4+ and Opera7+
    >
    > <script type="text/javascript">
    > <!-- // Begin
    > function bookmarksite(title,url){
    > if (window.sidebar) // Firefox
    > window.sidebar.addPanel(title, url, "");
    > else if(window.opera && window.print){ // Opera
    > var elem = document.createElement('a');
    > elem.setAttribute('href',url);
    > elem.setAttribute('title',title);
    > elem.setAttribute('rel','sidebar');
    > elem.click();}
    >
    > else if(document.all) // IE
    > window.external.AddFavorite(url, title);}
    >
    > // End -->
    > </script>
    >
    > <a href="javascript:bookmarksite('Page Title',
    > 'http://www.example.com')">Bookmark this site!</a>
    >
    >
    >
    > Pipp wrote:
    > > Hi, this simple code works well to add a bookmark on IE, but it
    > > doesn't work on Firefox
    > > <a href="javascript:window.external.AddFavorite('http://
    > >www.mysite.com','Mysite is cool');">

    >
    > > Can someone suggest me something ?- Nascondi testo tra virgolette -

    >
    > - Mostra testo tra virgolette -
     
    Pipp, May 6, 2007
    #3
  4. Pipp

    Mad Joe Guest

    Re: Cross browser Bookmark

    Randy Webb wrote:
    > Remove the worthless, non-working, useless comments.


    I'm hiding it because of the stupid W3C validators...

    > While Firefox may support sidebar, it may not be the only browser that
    > does. But, at least this branch of the if half tests for what you are
    > using.
    > Is there a browser (or even a version of Opera) that doesn't support
    > window.print? And, why aren't you testing for what you really want to use?
    > IE is far from the only browser that will enter this branch. AOL, for
    > one, will pass that test but utterly error out on the call to
    > window.external, and, there is *no* way to add a favorite in AOL via
    > scripting.


    Ask Frankyboy: http://www.dynamicdrive.com/dynamicindex9/addbook.htm

    > What happens if scripting is disabled? And, what happens, in IE, when an
    > animated gif is on the page? (Test it).


    What if somebody plugs our visitor's ass on 220V and torture him to
    death while another jerk is recording the whole event for publishing on
    YouTube? Maybe we should build a script which could prevent that sick
    possibility to avoid the mess with the law.
     
    Mad Joe, May 7, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan M

    Move to bookmark after postback

    Dan M, Jul 2, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    473
    Steve C. Orr, MCSD
    Jul 2, 2003
  2. Chris M

    Bookmark Anchors and VB.NET

    Chris M, Oct 24, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    879
  3. John Carnahan

    Navigating to a bookmark on page?

    John Carnahan, Nov 13, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    563
    John Carnahan
    Nov 13, 2003
  4. Ren
    Replies:
    1
    Views:
    447
    =?Utf-8?B?U2F0aXNo?=
    Apr 20, 2004
  5. Replies:
    0
    Views:
    98
Loading...

Share This Page