Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I raised question about Opera Browser Bookmark not working.
I Tried this following,

Code 1:
C#
if (window.opera && window.print) {
               var elem = document.createElement('a');
               elem.setAttribute('href', url);
               elem.setAttribute('title', title);
               elem.setAttribute('rel', 'sidebar');
               elem.click();
           }


This code I tried but not added in Opera Book mark list.
How to add URL in opera browser Bookmark list.
Please anyone reply me.
Posted
Updated 22-May-13 0:36am
v2

1 solution

Something like this should work:

function AddToFavorites(obj, title, url){
  if(window.sidebar){
    // Mozilla Firefox Bookmark
    window.sidebar.addPanel(title, url,"");
    return false;
  } else if(window.external){
    // IE Favorite
    window.external.AddFavorite( url, title);
    return false;
  } else if(window.opera && window.print){
    //Opera Hotlist
    obj.setAttribute('href',url);
    obj.setAttribute('title',title);
    obj.setAttribute('rel','sidebar');
    obj.click();
    return false;
  }
}


Call it as follows:

<a href="#" onclick="AddToFavorites(this, 'your title', 'your url');">Bookmark This Page</a>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900