繁体   English   中英

iframe visual studio html5 windows 8 app

[英]iframe visual studio html5 windows 8 app

我正在创建我的第一个地铁风格的Windows 8应用程序。 我正在尝试使用iframe for runescape。

这是我的代码:

    <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Runescape_Metro_Client</title>

    <!-- WinJS references -->
    <link href="//Microsoft.WinJS.2.0/css/ui-dark.css" rel="stylesheet" />
    <script src="//Microsoft.WinJS.2.0/js/base.js"></script>

    <!-- Runescape_Metro_Client references -->
    <link href="/css/default.css" rel="stylesheet" />
    <script src="/js/default.js"></script>
</head>
<body>
    <iframe sandbox="allow-scripts" id="Iframe" src="http://www.runescape.com/game" style="width:100%; height:100%"></iframe>
</body>
</html>

这是我得到的错误:

APPHOST9625:Kan niet navigeren naar:' http ://www.runescape.com/game'。 Een iframe heeft geprobeerd om naar een URI te navigeren die niet是de ApplicationContentUriRules voor deze app中的opgenomen。 gebruik in plaats daarvan een x-ms-webview-element om de URI te bekijken of voeg de URI toe aan de ApplicationContentUriRules-sectie van het pakketmanifest,zodat het iframe daarnaartoe kan navigeren。 (Voeg in Visual Studio deze URI toe aan het tabblad Content URIs van de Manifest Designer。)

(用谷歌翻译成英文翻译是:

APPHOST9625:无法导航至: http ://www.runescape.com/game。 iframe尝试导航,但不包含在此应用的ApplicationContentUriRules中。 到URI相反,使用x-ms-webview元素来查看URI是否将URI添加到包清单的ApplicationContentUriRules部分,因此iframe将在那里进行导航。 (在Visual Studio中将此URI写入Manifest Designer URI的Content选项卡。)

谷歌没有帮助,所以我在这里问它。

对于Windows 8.1应用程序,您不能再将iframe用于非安全http URI。 您将在问题中收到错误消息,建议您只需将URI添加到ApplicationContentUriRules,但它只允许您将https URI添加到规则中。

因此,如果要从应用程序提供非安全内容,则必须使用专有的<x-ms-webview>标记而不是<iframe> (例如<x-ms-webview src="http://www.google.com">

http://www.kraigbrockschmidt.com/2014/01/13/frame-to-webview-part-one/

迁移到Windows 8.1时,在大多数情况下,应使用x-ms-webview控件代替iframe。 它通常就像在标记中替换一样简单。 但是,如果你在Win8中与iframe进行postMessage通信,则需要转换该代码以使用webview的invokeScriptAsync(以调用webview中的函数)并使用window.external.notify将事件提升回应用程序。

您需要打开apppackage.manifest文件并转到内容URI选项卡,包含您尝试从iframe启动的网址。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM