如何在 Windows Phone 7 上调试 Internet Explorer?
我不是 Windows Phone 开发人员,我希望尽可能少地参与与 Microsoft 相关的任何事情。尽管如此,我需要让我的移动 Web 应用程序在 Windows Phone 7 上正常运行。该平台有哪些调试工具可用?像 Webkit 开发者工具或 Firebug 这样的工具是理想的选择,无论是从手机本身还是更可能从我的计算机进行远程调试。
如果这样的东西不存在,我会满足于能够读取 Javascript 错误消息,并使用 alert()
或类似的方法查看变量的内容。此时,我所知道的是我的 JS 失败了:我不知道在哪里或为什么,更不用说如何修复它了。
我的开发计算机运行的是 OS X,如果可能的话,我真的希望能够在 OS X 上使用这些工具。假设调试工具存在(我真的希望它们如此),它们是专为 Windows 设计的吗?如果是这样,有谁知道他们与 Wine 或类似产品的配合效果如何?
编辑:我有一个物理 Windows Phone 7 设备,因此我可以使用它。但是,alert()
似乎不起作用,这就是我发布这个问题的原因。 alert()
在 WP7 浏览器上正常工作吗?
I'm not a Windows Phone developer, and I want as little to do as possible with anything related to Microsoft. Nonetheless, I need to get my mobile web app running properly on Windows Phone 7. What debugging tools are available for the platform? Something like the Webkit developer tools or Firebug would be ideal, either from the phone itself or more likely, remotely debugging from my computer.
If such a thing doesn't exist, I'd settle for being able to read Javascript error messages, and view the contents of variables using alert()
or similar. At this point, all I know is that my JS is failing: I don't know where or why, let alone how to fix it.
My dev computer is running OS X, and I'd really like to be able to use these tools from OS X if possible. Assuming that debugging tools exist (which I really hope they do) are they designed for Windows only? If so, does anyone know how well they would work with Wine or similar?
EDIT: I have a physical Windows Phone 7 device, so I can use that. However, alert()
doesn't seem to be working, which is why I'm posting this question. Does alert()
normally work on the WP7 browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可能会发现 Mobile Perf Bookmarklet 是最简单的一体化测试工具任何移动设备。
到目前为止,在我的测试中,在 iPhone/iPad/Samsung Galaxy Tab 上运行良好。
引用:
You'll likely find the Mobile Perf Bookmarklet to be the easiest all-in-one tool for testing any mobile device.
Works well on the iPhone/iPad/Samsung Galaxy Tab in my testing so far.
Quote:
除非您拥有 Windows Phone 7 设备,否则您需要在 BootCamp 中运行 Windows 并安装 Windows手机开发者工具,以便在模拟器上的 IE 中进行测试。我不了解 Whine,但我在尝试在 Parallels 中测试时遇到了重大问题 - 因此根据我的经验,我建议保持尽可能简单。
手机上的 IE 中没有控制台,因此您需要使用警报,就像您建议的那样,或者只是将文本写入页面上的 div 作为自定义控制台。
如果你真的想在 OS X 中编码(我绝对理解),那么使用单独的机器在 WP7 模拟器中测试 IE 将是你最好的选择。
编辑:我刚刚测试了警报,它在我的 Windows Phone 上运行良好。我的猜测是语法错误阻止了它的调用。
Unless you have a Windows Phone 7 device, you will need to run Windows in BootCamp and install the Windows Phone Developer Tools in order to test in IE on the emulator. I don't know about Whine, but I ran into major problems trying to test in Parallels - so based on my experience, I suggest keeping it as simple as possible.
There is no console in IE on the phone, so you will need to use alert, like you suggested, or just write text to a div on your page as a custom console.
If you really want to code in OS X (which I definitely understand), using a separate machine for testing IE in the WP7 emulator is going to be your best bet.
EDIT: I just tested alert and it did work fine on my Windows Phone. My guess is that a syntax error is preventing it from calling.
下面的可能会有趣
适用于 Windows Phone 的简单 IE 调试工具
支持
不支持
The following may be interesting
Simple IE debug tool for Windows Phone
Supports
Not supported
只是想添加一条注释,说明现在可以使用 Windows Phone 8.1 和 Visual Studio 2013 Update 2 进行完整的 JavaScript 调试。完整的详细信息请访问:
http://blogs.msdn.com /b/visualstudioalm/archive/2014/04/04/diagnosing-mobile-website-issues-on-windows-phone-8-1-with-visual-studio.aspx
我意识到这没有帮助原始问题(WP7)中引用的版本,但我希望这将帮助那些可能找到这个问题并正在运行更新版本的人。
Just wanted to add a note to say that full JavaScript debugging is possible now with Windows Phone 8.1 and Visual Studio 2013 Update 2. Full details are available at:
http://blogs.msdn.com/b/visualstudioalm/archive/2014/04/04/diagnosing-mobile-website-issues-on-windows-phone-8-1-with-visual-studio.aspx
I realize that this doesn't help the versions referenced in the original question (WP7), but I'm hoping this will help people who may find this question and are running a more recent version.
对我有用的方法是通过 Windows Vista 内置的 Internet Explorer 浏览器测试我的移动页面。
它附带了一个脚本调试器(您必须通过“Internet 选项”菜单在“高级选项”选项卡中启用该调试器),而且它似乎非常接近 Internet Explorer Mobile 实现。
另一个提示是,您还可以使用 document.write 或将输出设置为 div 内容,而不是使用 window.alerts。
Something that has worked for me, is to test my mobile pages through the Windows Vista built-in Internet Explorer browser.
It comes with a script debugger ( which you have to enable in Advanced Options tab through the Internet Options menu ), and it seems that it gets really close to the Internet Explorer Mobile implementation.
Another tip would be, that, instead of using window.alerts, you can also use document.write or set output to a div content.
我正在使用这个 hack 让 console.log 将信息发送回服务器(它使用 window.fetch,我正在填充它,但可以使用 xhr 代替) https://gist.github.com/wheresrhys/bf93057ee3a594454582
I'm using this hack to have console.log send info back to the server (it uses window.fetch, which I'm polyfilling, but could use xhr instead) https://gist.github.com/wheresrhys/bf93057ee3a594454582