部署到 Azure WebApp + swf 播放器

Deploying to Azure WebApp + swf player

这不是我的专业领域,所以,基本上我正在尝试测试这个基于 Flash 播放器的 Web 应用程序,我们的合作伙伴发送的文档在文件资源管理器中或在 VS'17 中进行调试时效果很好。

以下是 launcher.htm 的 HTML 代码,但是当我尝试将它放入带有 VS'17 的 Azure Web 应用程序时,所有文件和文件夹都部署正常,但是当我启动相同的文件和文件夹时文件完全空白。

据我所知,它唯一的 iframe 的 src 子句存在一些问题,因为它在 '$[=32= 上获得了 属性 ] 与 JavaScript。当它在本地运行时有 src,当从 Azure 运行时没有 src。

可能是某种阻止在 Web 服务器上发布的触发器,或者可能是我无法处理的一些愚蠢的事情,我的 JS 专业知识 3/10

非常感谢!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <script src="scripts/jquery-1.8.2.js" type="text/javascript"></script>
    <script src="scripts/launch_wrapper.js" type="text/javascript"></script>
    <script src="scripts/helper.js" type="text/javascript"></script>
    <script type="text/javascript">
        var settingInfo; //NavexGlobal change, storing settings.xml information.
        var cbt_data = new Object;
        function removeTags(str,tag){
            var re= new RegExp('<'+tag+'[^><]*>|<.'+tag+'[^><]*>','g')
            var text =str.replace(re,'');
            return text;
        }
        function updatePageTitle(pageTitle)
        {
            document.title = removeTags(pageTitle,'font');
        }

        //NavexGlobal change, handling config.js to load completion.
        function handleConfigScriptAdded()
        {
            setDefaults();
            setTitle();
            cbt_data.rubrics = settingInfo.rubrics;
            cbt_data.mcp_swf = settingInfo.mcp_swf;
            cbt_data.video_base = settingInfo.video_base;
            cbt_data.version = versionInfo;
            if(settingInfo.mobileEnabled != undefined)
            {
                cbt_data.mobileEnabled = settingInfo.mobileEnabled;
            }
            cbt_data.tc_config_xml = settingInfo.tc_config_xml;
            cbt_data.document = document; //reuired for updating the title with pageid for QA
            var url = "launch-mobile.html"+location.search; //launch url
            document.getElementById("ifrm").src = url;
            //
            if(!checkFlashVersionSuppot() && cbt_data.mobileEnabled != undefined && String(cbt_data.mobileEnabled).toLowerCase() == "true")
            {
                $(window).bind('orientationchange', function() {
                    if ( orientation == 0 ) {
                        orientation = "Portrait";
                    }
                    else if ( orientation == 90 ) {
                        orientation = "Landscape";
                    }
                    else if ( orientation == -90 ) {
                        orientation = "Landscape";
                    }
                    else if ( orientation == 180 ) {
                        orientation = "Portrait";
                    }
                    if(document.getElementById("ifrm").contentWindow.updateOrientation != undefined)
                    {
                        document.getElementById("ifrm").contentWindow.updateOrientation(orientation);
                    }
                });

                document.getElementById("ifrm").src = "launch-mobile.html"+location.search;
                //document.getElementById("ifrm").src = "html5/launch-mobile.html"+location.search;
            }
            else
            {
                var url = "launch.htm"+location.search; //launch url
                document.getElementById("ifrm").src = url;
            }
            var url = "launch_elt.htm"+location.search; //launch url
            document.getElementById("ifrm").src = url;
        }


        //NavexGlobal change for loading config.js files dynamically.
        function launch(settingData)
        {

            settingInfo = settingData;
            addScriptTag(settingInfo.configPath, handleConfigScriptAdded); //adding script tag for config.js
        }

        //NavexGlobal change for setting title of the html file.
        function setTitle()
        {
            if(settingInfo.courseTitle != null)
            {
                cbt_data.courseTitle = unescape(unescape(settingInfo.courseTitle));
            }
           // $(document)[0].title = cbt_data.courseTitle+" v"+settingInfo.navpanelVersion;
            $(document)[0].title =  'NAVEX Global'; //  change by aneesh
        }

        //NavexGlobal change for loading setting.xml containing mcp wrapper details.
        $(document).ready(function(){
            init();
            alert('hola papi');
        });

        // for checking flash support


        function checkContentType()
        {
            var strPath ;
            if(checkFlashVersionSuppot())
            {
                strPath="launch_elt.htm"+location.search; //launch url
                //alert("go with Flash version");
            }
            else
            {
                strPath="launch-mobile.html"+location.search; //launch url
                //strPath="html5/launch-mobile.html"+location.search; //launch url
            }
            return strPath;
        }

        function checkFlashVersionSuppot()
        {
            var hasFlash = true;
            try {
                var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
                if(fo) hasFlash = true;
                //alert("status @1 "+ hasFlash )
            }catch(e){
                //if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
                //alert("status @2 "+ hasFlash );
                try
                {
                    if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
                    {
                        //return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
                        hasFlash = true;
                    }
                }
                catch(e)
                {
                    hasFlash = false;
                }
            }
            alert("status @44 "+ navigator.mimeTypes ["application/x-shockwave-flash"] );
            return hasFlash;
        }

        function supports_canvas()
        {
            //alert(!!document.createElement('canvas').getContext);
            return !!document.createElement('canvas').getContext;
        }


    </script>
</head>
<body>
<iframe id="ifrm" name="ifrm_wrapper" frameborder="0" style="position:absolute; top:0px; left:0px;" width="100%" height="100%" scrolling="No"></iframe>
</body>
</html>

对自己的回答

好的,所以我发现 Azure Web App 没有设置所有 mime 类型,默认情况下会阻止所有 jquery 扩展名为 json 的文件,所以你必须注册在 web.config 的 StaticContent 子句中输入此 mime 类型并添加

      <mimeMap fileExtension=".json" mimeType="application/json" />

来源json support in Azure Web Apps