Hi Guys,
is there any way which I can access the browser context menu?
Thanks in advance.
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
Check the following code:
var changed = false;
if (appAPI.platform == "CH") { //the following code should run only for Chrome
appAPI.chrome.contextMenu.add('contextMenuID','Click Me',function(){
alert('menu clicked');
if(!changed){
changed = true;
appAPI.chrome.contextMenu.updateTitle('contextMenuID','Click me Again');
} else {
appAPI.chrome.contextMenu.updateTitle('contextMenuID','Click to Remove');
appAPI.chrome.contextMenu.updateOnClick('contextMenuID',function(){
appAPI.chrome.contextMenu.remove('contextMenuID');
});
}
});
}
This code should run at the 'background code' and currently is supported by Chrome only.
It's part of our pipeline to have this feature to all browsers and because of that we didn't document it yet. I'm posting this example in here as it's a good chance for us to get feedback in case something is missing or if you prefer it to work in a different way. -
-
Hi,
thanks for the fast answer :)).
Are you sure it is the correct code? I just pasted this example in background tab in may test project and is does not work! May be I do some stupidness somewhere.
This is the url to my project : http://crossrider.com/install/325-my-...
Any suggestions?
Thanks in advance. -
-
I looked at it and found this error:
ERROR MESSAGE: Uncaught Error: You do not have permission to use 'contextMenus.create'. Be sure to declare in your manifest what permissions you need.
note: you can view this error by looking at your extension console tab.
When we packed your extension we didn't add the context menu permission (our fault!).
This is fixed now, so please open the extension manager (you can do that by right-click on your extension icon and click "Manage Extensions..."), make sure you are in developer mode (by clicking the small '+' if needed) and click the "Update extensions now" button. It will update your extension and will work well now :) (I have verified it)
And thanks for catching this ;-)-
Just to note that with Crossrider you don't need to manually update your extensions!
Crossrider is taking care of auto update your extension (on all browsers) automatically but we used this method to force update now instead of waiting couple of hours. just fyi :) -
-
-
-
-
Bravo :),
it works fine now :) if i find any other bugs i will write :)
Thanks once again :) -
-
I am generating context menu when user selects some text and right click it. I tried implementing it, problem is even sample application is not working.
http://crossrider.com/apps/10565/ide
appAPI.contextMenu.add("key1", "Display data object", function (data) {
var sAlertText = 'pageUrl: ' + data.pageUrl + '\r\n' +
'linkUrl: ' + data.linkUrl + '\r\n' +
'selectedText:' + data.selectedText + '\r\n' +
'srcUrl:' + data.srcUrl;
alert(sAlertText);
}, ["all"]);
Only data.pageUrl is available rest of all are "undefined". I want selectedText.
I am implementing it in chrome 17. -
-
-
Loading Profile...




EMPLOYEE



Can you pls send us at support [at] crossrider [dot] com some info about your add-on and your needs. This will help us set higher priority for this feature