主要问题在标题中。我需要在桌面软件中模拟移动浏览器。我需要从桌面 View 切换到移动 View ,反之亦然。我的第一个想法是将 View 调整为移动标准尺寸。适用于只关注帧大小的各大网站。
但我不确定 webview 是否被视为真正的移动 webview。有没有办法将 Qt WebEngine 配置为移动浏览器或简单地伪造它?
最佳答案
您需要在 Qt WebEngine 中设置 header UserAgent
。
https://varvy.com/mobile/vary-user-agent.html
如@demonplus 所述,使用 httpUserAgent属性(property)。
关于Qt Web 引擎 : Is there a way to emulate a mobile browser?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37418717/