Visual Studio 13,将HTML5网页重定向到外部网站

Visual Studio 13, redirect a HTML5 webpage to external website?

本文关键字:重定向 外部 网站 网页 HTML5 Studio Visual      更新时间:2023-09-26

我对Visual Studio 13一点经验都没有,但我设法编译了一个简单的HTML5网站,以便它显示在应用程序中。

经营一个网站,我基本上想将其集成到Windows 8.1 UI应用程序中。我尝试过这样的代码:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=http://mywebsite.com">
        <script type="text/javascript">
            window.location.href = "http://mywebsite.com"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='http://mywebsite.com'>link to example</a>
    </body>
</html>

但是它给了我一个APPHOST9624错误。即使我单击HREF链接,它也失败了。

显然我以错误的方式处理这个问题,所以我的问题是。如何创建仅全屏显示外部网站的 Windows 8.1 应用商店应用?

编辑:您实际上希望将网站集成到商店应用程序中,因此此解决方案不适合您,只是注意到:)似乎还有一个 WebView 控件,尽管所有示例都在 XAML 中,因此它可能在 HTML5 应用程序中不受支持......

我建议您使用该新 URI 启动默认浏览器,尽管这会打开一个新的浏览器实例,不确定这是否是您想要的。为此,请尝试致电

Windows.System.Launcher.launchUriAsync(uri).done( /* Your success and error handlers */ );