Skip to content

Instantly share code, notes, and snippets.

@pastak
Created September 22, 2013 16:12
Show Gist options
  • Save pastak/6661411 to your computer and use it in GitHub Desktop.
Save pastak/6661411 to your computer and use it in GitHub Desktop.
document.addEventListener('contextmenu', function (e) {
var port = chrome.extension.connect();
var type = 'default';
if (e.target.tagName == 'A'){
type = 'link';
}
var url = e.target.href || '';
port.postMessage({
message : 'create_context_menu',
data:{
type : type,
url : url
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment