Hello i am developing extension on crossrider. i've created a button this
'<button id="xr-bookmark" title="Bookmark button" class="middle"><a id="bookmarkme" href="#" rel="sidebar" title="bookmark this page">Bookmark This Page</a></button>'
and using it action to bookmark the current page is in extension.js
$('#xr-crossrider-example #xr-bookmark')
.click(function () {
$(function() {
$("#bookmarkme").click(function() {
// Mozilla Firefox Bookmark
if ('sidebar' in window && 'addPanel' in window.sidebar) {
window.sidebar.addPanel(location.href,document.title,"");
} else if( /*@cc_on!@*/false) { // IE Favorite
window.external.AddFavorite(location.href,document.title);
} else { // webkit - safari/chrome
alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
}
});
});
});
but it's not working so please anybody tell me right code which i can use to bookmark the current page. and i've tested this code on mozilla only.
Crossrider has an API specifically for managing bookmarks via a Crossrider extension. To use the plugin, simply add it to the extension and in the background scope, use the appAPI.bookmarks API that it provides. Since the bookmark API is only available in the background scope, the button handler you are using in the extension scope must pass the bookmark data to the background scope using messaging.
So, using your example, your code would look something like:
extension.js:
background.js:
[Disclosure: I am a Crossrider employee]