Search code examples
htmlnpapinpruntime

npruntime plug-in installation


i made a simple html page that includes npruntime plug-in and it works fine locally. of course npruntime object file(npmyapp.dll) has been already registered so browser can load plug-in.

(loading plug-in code is something like ..)

<embed type="application/x-mytestapp" width="400" height="200">

What i want to know is how to require installation if browser can not find plug-in.

for example, when we explore web site including flash player before flash player installed, browser asks installation. how?

any help will be appreciated. thanks!


Solution

  • Not 100% certain if you can do with with an embed tag or not (embed tags have given be weird issues throughout the years; I avoid them and use object tags instead) but you can put code inside an object tag that will only show up if your plugin isn't found.

    <object type="application/x-mytestapp" width="400" height="200">
        <a href="http://mytestapp.com/plugin/plugin_installer.msi">You are missing a plugin; click here to download it</a>
    </object>
    

    That said, my preferred install method is to use javascript to detect if it is installed or not, which you can do by looking at navigator.plugins and either enumerate and check for the mimetype or look it up by name.

    FireBreath has a sample javascript detector/injector that demonstrates this: https://github.com/firebreath/FireBreath/blob/master/Installer/js/fb_installer.js