WordPress.org

Ready to get started?Download WordPress

Forums

Bookmark Us Script (4 posts)

  1. theresel
    Member
    Posted 4 years ago #

    I've managed to insert a javascript call into my WordPress header which is supposed to provide a link for viewers to bookmark our site. Although the code is working perfectly when inserted into an html file and viewing it with IE or Netscape, it is not working with Netscape when I insert it into the php header file, it only works with IE. The link part is probably wrong, I took it from another wordpress page and just changed parameters so it's picking up the translated text also.

    Link in a regular html can be viewed at : http://www.carnavalhearstcarnival.com/pratique.html
    Link in the header can be viewed at : http://www.carnavalhearstcarnival.com

    Both use the same script, except the latter is in a php page.

    Can someone help?

    My header contains the following code:

    Code moderated as per the Forum Rules

  2. theresel
    Member
    Posted 4 years ago #

    Oops, here's the code in the head section:

    function bookmark_us(url, title){
    
    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);
    }

    And here's the link code:
    <?php echo sprintf(__("<a href=\"javascript:bookmark_us('http://www.carnavalhearstcarnival.com','Carnaval de Hearst Carnival')\">Bookmark our site!</a>"), __("Bookmark our site!")); ?>

  3. theresel
    Member
    Posted 4 years ago #

    Anyone??

  4. fuzzie
    Member
    Posted 3 years ago #

    did you figure this out?

Topic Closed

This topic has been closed to new replies.

About this Topic