WebBrowserTask 失败

发布于 2024-10-04 06:20:49 字数 214 浏览 0 评论 0原文

以下代码有时有效,但大多数时候无效:

WebBrowserTask wbt = new WebBrowserTask();
        wbt.URL = url;
        wbt.Show();

在模拟器和真实设备(HTC HD7)上。它将打开网络浏览器 (IE),但不会输入 URL 或导航至该 URL。

什么给?

The following code works sometimes and most of the time not:

WebBrowserTask wbt = new WebBrowserTask();
        wbt.URL = url;
        wbt.Show();

On both the emulator and a real device (HTC HD7). It will bring up the web browser (IE) but it will not put in the url or navigate to it.

What gives?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以往的大感动 2024-10-11 06:20:49

每次执行代码时,它都会弹出一个新选项卡。因此,如果您查看@您的选项卡,您将看到带有您的 URL 和一堆空白的选项卡 - 这是不好的行为。

不过,不良行为仅在调试时发生。因此,如果您使用 ctrl+F5 启动或仅从手机运行该应用程序,它应该按您的预期运行。

编辑:强调答案 - 谢谢。

Every time you execute the code, it brings up a new tab. So, if you look @ your tabs, you will see the one with your URL and a bunch of blanks -- which is the bad behavior.

The bad behavior only happens when debugging, tho. So, if you launch with a ctrl+F5 or just run the app from your phone, it should work as you expect.

EDIT: Accentuated the answer - thanks.

少女情怀诗 2024-10-11 06:20:49

正如 JP Alioto 提到的那样,我只在调试时看到它实际上失败...然后如果您进入 URL 栏并再次出来,IIRC 它会在此时加载。 (虽然我已经有一段时间没有这么做了,所以我可能是错的。)这很奇怪。如果您在调试时看到此行为,那么最好了解更多详细信息。

WebBrowserTask 需要注意的一点是它不处理带有“&”的 URL。 - 我在启动任务之前使用 Uri.EscapeDataString(url) 。它逃逸的次数远远超过了所需的次数,但据我所知,这没有任何不良影响。 (我猜,这可能意味着您的“最大 URL 长度”实际上比其他情况要短。)

I've only seen it actually fail when debugging, as JP Alioto mentions... and then if you go into the URL bar and come out again, IIRC it loads at that point. (It's been a while since I've done that though, so I could be wrong.) It's very odd. If you're seeing this behaviour when you're not debugging, it would be good to get more details.

One point to note with the WebBrowserTask is that it doesn't handle URLs with "&" in - I use Uri.EscapeDataString(url) before launching the task. It escapes much more than is required, but that has no ill effects that I'm aware of. (It could potentially mean that your "maximum URL length" is effectively shorter than it would be otherwise, I guess.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文