简体   繁体   English

使用WebKit在Windows上模拟iOS和Android内置浏览器

[英]Emulating iOS and Android built-in browsers on Windows with WebKit

I am developing a mailing application with .NET and it auto generates the CSS for different screen sizes. 我正在使用.NET开发一个邮件应用程序,它会自动为不同的屏幕大小生成CSS。 What is the best way to view the results in Windows? 在Windows中查看结果的最佳方法是什么?

Android and iOS devices use WebKit, but I am not sure how to mimic the screen size. Android和iOS设备使用WebKit,但我不确定如何模仿屏幕大小。

For example, when I have something like: 例如,当我有类似的东西:

<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="css/mobile.css" type="text/css" />

I am not interested in online emulators, I am using WebKit.NET 我对在线模拟器不感兴趣,我使用的是WebKit.NET

Try this tool out 试试这个工具

http://quirktools.com/screenfly/ http://quirktools.com/screenfly/

As far as different browsers just download tthm and try it on your windows by using that site 至于不同的浏览器只需下载tthm并使用该网站在您的Windows上尝试

There are many online emulators to test your website. 有许多在线模拟器可以测试您的网站。 http://www.coderebel.com/support/features/iphone-simulator.html http://iphone4simulator.com/ http://iphone-emulator.org/ http://www.coderebel.com/support/features/iphone-simulator.html http://iphone4simulator.com/ http://iphone-emulator.org/

you can also use Spoon.net to test your website in various browser 您还可以使用Spoon.net在各种浏览器中测试您的网站

On your place I would install a mountain lion + XCode in a VirtualBox on windows, and check on Safari. 在你的地方我会在Windows上的VirtualBox中安装一个山狮+ XCode,并检查Safari。 You can emulate IPhone and other devices in Safari. 您可以在Safari中模拟iPhone和其他设备。

here is a simple referecne how to debug a website under iOS safari emulation in OSX Safari 这是一个简单的参考如何在OSX Safari中的iOS safari仿真下调试网站

I haven't attempted this with WPF, but with Windows Forms it works as you would expect, so this may help: 我没有尝试使用WPF,但使用Windows Forms它可以正常工作,所以这可能会有所帮助:

I use media queries along the lines of: 我使用媒体查询:

@media (min-width: 300px) {

and I have a WebKitBrowser control docked to fill a panel (as I have some controls docked to the top of my form) and can confirm than simply setting the form dimensions, eg 并且我有一个WebKitBrowser控件停靠以填充面板(因为我有一些控件停靠在我的表单的顶部)并且可以确认而不是简单地设置表单尺寸,例如

this.MaximumSize = this.MinimumSize = this.Size = new Size(width, height);

triggers the media queries as I would expect. 像我期望的那样触发媒体查询。 Eg I have a Portrait/Landscape button that I use, this just flips the width and height of the form and the docked browser fills that new orientation. 例如,我有一个我使用的纵向/横向按钮,这只是翻转表单的宽度和高度,停靠的浏览器填充新的方向。 Should be pretty straightforward? 应该很简单吗?

I guess if you try it out, and then it doesn't work, you can then provide a bit more information about what is/isn't working. 我想如果你尝试一下,然后它不起作用,你就可以提供更多关于什么/不起作用的信息。

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

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