我试着在Flutter中使用webview_flutter插件。但在那里找不到设置用户代理。它应该在那里,对吧?这是webview的一个基本功能。有没有可能做到这一点?提前谢谢你。
发布于 2019-08-19 15:10:10
webview_flutter: ^0.3.13引入了用户代理,所以现在可以很容易地使用它,比如
WebView(
userAgent: "random",
initialUrl: "https://stackoverflow.com/questions/54102162/how-to-use-user-agent-in-webview-flutter-flutter",
)发布于 2019-05-06 06:00:50
尝试使用Flutter_webview_plugin here
您可以添加以下变量(包括userAgent),如文档中所示:
Future<Null> launch(String url, {
Map<String, String> headers: null,
bool withJavascript: true,
bool clearCache: false,
bool clearCookies: false,
bool hidden: false,
bool enableAppScheme: true,
Rect rect: null,
**String userAgent: null,**
bool withZoom: false,
bool withLocalStorage: true,
bool withLocalUrl: true,
bool scrollBar: true,
bool supportMultipleWindows: false,
bool appCacheEnabled: false,
bool allowFileURLs: false,
});https://stackoverflow.com/questions/54102162
复制相似问题