Qt Web 引擎 : Is there a way to emulate a mobile browser?

标签 qt mobile qtwebengine

主要问题在标题中。我需要在桌面软件中模拟移动浏览器。我需要从桌面 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/

相关文章:

c++ - MinGW 在 Windows XP 上失败

css - 如何停止在移动设备上滚动以及为什么翻译似乎停止了滚动?

linux - Mendeley 找不到 "Qt WebEngine Plugins"(Linux 桌面应用程序)

python - Ubuntu 13.04 上的 PySide 导入错误

Qt Mac (Re)move "Special Characters..."编辑菜单中的操作

c++ - QAbstractListModel 的子类只能作为 QML 中的父类(super class)使用

flutter - 当您无法访问支架时,如何在应用栏中快速切换/删除 Action ?

ios - 用于设计移动界面/应用程序的标记语言是什么?

qt - 如何使用元工具链-qt5 构建 Qt(支持 QtWebEngine)?

qtWebengineProcess 无法启动