Uncaught Error: Error calling method on NPObject

前端 未结 2 1042
别跟我提以往
别跟我提以往 2020-12-06 03:54

I have a flash video on my page as follows:



        
相关标签:
2条回答
  • 2020-12-06 04:33

    I was getting the same error message. The problem only occurred when Flash made an ExternalInterface call that returned after Flash crashed (for what reason whatsoever). The fix I implemented was: Check if the Flash object is still up and running and if the callback is still a function of that object.

    0 讨论(0)
  • 2020-12-06 04:50

    NPObject is an "interface" to any "foreign" code exposed through the browser (foreign, as in foreign to JavaScript, otherwise it may be browser's own objects, like the global window object for example). The embedded Flash plugin would certainly implement this "interface" (so the browser sees it as just another NPObject).

    When you call a method on that object, there are several function that wrap that call serializing the data passed to the object and back to browser's runtime. It is difficult to tell for certain what exactly didn't work, but some common reasons would include:

    1. The plugin does not expose (or did not register yet) a method with the name you are trying to call.
    2. The plugin was embedded in a way that crosscripting is not allowed (the limitations may be on both sides, Flash requires that the call comes from a trusted domain and you may restrict the plugin from communicating with environment through the settings in the object tag.
    3. An error thrown in the plugin's code invoked through JavaScript - I'm not sure that would be the same error, but it is very much likely.
    0 讨论(0)
提交回复
热议问题