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

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -