ExternalInterface in Chrome

匆匆过客 提交于 2019-12-06 12:30:34

This is a bug in Chrome using the pepper plugin: https://code.google.com/p/chromium/issues/detail?id=137734

What's happening is that the trusted locations (set here: https://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html) aren't taken into account, so any Flash <-> JS interaction is broken.

It doesn't look like this bug is getting fixed (judging by the comments on the issue today, there's a good chance it'll get marked as a "Won't fix"), so for now there's 3 ways around it:

  • Use another browser - not ideal
  • Use the NPAPI plugin - the pepper plugin is the default, but it's mostly a set-once-and-forget sort of task
  • Run a local webserver - either something like apache (http://www.easyphp.org/) or node (http://nodejs.org/). This is Google's preferred method of dealing with this, as it more closely mimics network behaviour (including security stuff)

This code helps you to check if PepperPlayer is installed:

checkPepperPlayer=function(){
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
    if (is_chrome) {
        var pluginsList = navigator.plugins;
        for (var plugin in pluginsList) {
            if (plugin && pluginsList[plugin] && pluginsList[plugin].filename) {
                var filename = pluginsList[plugin].filename;
                if (filename == "pepflashplayer.dll" || filename == "PepperFlashPlayer.plugin" || filename == "libpepflashplayer.so") {
                    return true;
                }
            }
        }
    }
    return false;
};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!