0

I am very new to Web development, and have been writing some javascript that makes use of WScript.Shell via ActiveX. I am aware that browsers other than IE don't support ActiveX though.

After doing some digging through Google, I have discovered that I may be able to do something similar on all web kit based browsers via NPAPI. I have no idea where to even begin when it comes to this though. Is it possible to do what I am after via NPAPI? If so, where would I begin?

2
  • NPAPI is for browser plugins, not code on pages. Commented Sep 2, 2010 at 12:13
  • Would i be able to create a plugin to ship to my customers and have them install though? Commented Sep 2, 2010 at 13:02

2 Answers 2

1

As long as you only care about Windows, you could simply use a NPAPI plugin to wrap the existing WScript.Shell - note however that plugins have to be embedded in the page; there is no equivalent for new ActiveXObject("..."). This also means you have to duplicate the scripting interface or write an automatic dispatcher for it.
For writing the plugin, take a look at the FireBreath project (disclaimer: i am its co-owner) which already gives you solutions for the most common tasks. If you want to do automatic dispatching for the scripting interface, take a look at ff-activex-host's implementation (in particular scriptable.h and axhost.cpp).

Sign up to request clarification or add additional context in comments.

1 Comment

I just built a plugin with FireBreath - took maybe 2 hours starting from scratch (the docs are a little... nonlinear) - I recommend the video tutorial!
0

While you can't do new ActiveXObject, your javascript can add an object tag to the DOM e.g.

var plugin = document.createElement('div');
plugin.innerHTML = "<OBJECT id='plugin0' blah blah blah ></OBJECT>";
document.body.appendChild(plugin);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.