Search code examples
c++cnpapi

How can I get an NPAPI plugin to read an "src" tag


i'm a little stuck on getting a plugin to work. I need it to take a "src" parameter but I can't seem to make it do this.

So i've basically got the npsimple basic plugin.

It's probably something really silly i'm missing Joe


Solution

  • You should get src as one of the parameters that are passed to NPP_New():

    NPError NPP_New
              (NPMIMEType    pluginType,
               NPP instance, uint16 mode,
               int16 argc,   char *argn[],
               char *argv[], NPSavedData *saved)
    {
        char* srcValue = 0;
    
        for(int i=0; i<argc; ++i) 
        {
            if(strcmp("src", argn[i]) == 0) {
                srcValue = argv[i];
                break;
            }
        }
    
        /* ... */
    }