I've come across games that are 3D that are playable in a browser. They require a plugin to be installed to work. I guess the plugin creates a D3D window inside the browser.

How would I go about implementing something similar?

  • \$\begingroup\$ interesting question \$\endgroup\$ – Notabene Jan 19 '11 at 10:50

Unity web player (for windows) can use both DirectX and OpenGL in a window (however it abstracts your access to these APIs).

Another approach would be to implement a DirectX plugin using ActiveX (for Internet Explorer), or NPAPI (for other browsers).

If you use NPAPI, when your plugin starts up you'll receive a window handle where you can draw whatever you want (including a D3D window). If you go this route you're essentially running native code on the clients machines.

  • \$\begingroup\$ Note that the NPAPI is on its way to deprecation, so it's recommended that new web games use other technologies like WebGL (which is getting increasingly well-supported and does not require additional plugins) \$\endgroup\$ – DMGregory Jun 24 '15 at 12:50

The game you are playing might use WebGL http://en.wikipedia.org/wiki/WebGL, or something more exotic like a firefox plugin, but I don't think you can embed machine code in a firefox plugin (I'm not sure, that would be a little security flaw).

Unity implements a web plugin version of their engine, and it seems they do so with ActiveX. I don't know if it implements on Mac..., I wonder though.

The best way to find out how this game you are playing use a 3D API or any other kind of plugin stuff, is to look at the HTML source of the page, and look for object or activex or else.

  • \$\begingroup\$ Why the down vote? \$\endgroup\$ – CiscoIPPhone Jan 19 '11 at 15:04
  • 4
    \$\begingroup\$ For the ludicrous suggestion you can't "embed machine code in a firefox plugin." The entire point of plugins is to supplement web content with some set of "native" code. \$\endgroup\$ – user744 Jan 19 '11 at 15:28
  • \$\begingroup\$ well we can still discuss the dictionnary entries for addon, extension, plugin, mod, etc... It's still better to be precise about what does what... \$\endgroup\$ – jokoon Jan 19 '11 at 16:05
  • 4
    \$\begingroup\$ And "plugin" is exactly what has, since Netscape Navigator 2, referred to executing unsandboxed (native or otherwise) code on the client machine. \$\endgroup\$ – user744 Jan 19 '11 at 16:14
  • 3
    \$\begingroup\$ netscape navigator 2, are you talking about a car, some kind of SUV ? I don't see any connection with the question ... \$\endgroup\$ – jokoon Jan 19 '11 at 16:20

Check out Firebreath for Cross-broswer support.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.