javascript - Allow content documents (web pages) to detect my Firefox addon -
in firefox addon i'm looking secure way let content code detect presence of addon itself. ideally i'd end allowing content code query presence of addon executing:
if (window.navigator.my_addon) { // addon present } else { // addon not present }
any suggestion/pointers?
adapted here (but using getter make my_addon value read-only)
// contentwindow window object of contentdocument being displayed var s = new components.utils.sandbox(contentwindow); s.window = contentwindow; components.utils.evalinsandbox(" window.wrappedjsobject.navigator.__definegetter__('my_addon', function(){ return true; // or whatever want value // (note: unprivileged code!) });", s );
Comments
Post a Comment