WhatsApp Web台式机模式扑来
我想在我的Flutter应用程序中打开WhatsApp Web桌面模式 如图所示 必需的结果
我被使用 webview_flutter webview_flutter_flutter_plutter_plust webview_flutter_plus same and case and case。
我的最初URL是
我使用的代码如下
class WhatsAppWebScreen extends StatefulWidget {
WhatsAppWebScreen({Key? key}) : super(key: key);
// late Completer<WebViewController> controller;
@override
State<WhatsAppWebScreen> createState() => _WhatsAppWebScreenState();
}
class _WhatsAppWebScreenState extends State<WhatsAppWebScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: const DrawerWidget(),
appBar: AppBar(
title: const Text("WhatsAppWeb"),
backgroundColor: Color(0xFF128D7E),
),
body: SingleChildScrollView(
child: Container(
height: 80.h,
child: WebViewPlus(
initialUrl: 'https://web.whatsapp.com',
userAgent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15",
javascriptMode: JavascriptMode.unrestricted,
),
),
),
);
}
}
每次我运行此代码时,URL都会重定向到
和类似这样的结果
我尝试了许多不同的用户代理字符串,但结果相同。
我使用NavigationDelegate参数来防止重定向URL。但是后来显示空白屏幕,
navigationDelegate: (request) {
if (request.url.startsWith('https://www.whatsapp.com/')) {
print('blocking navigation to $request}');
return NavigationDecision.prevent;
}
print('allowing navigation to $request');
return NavigationDecision.navigate;
},
onWebViewCreated: (webViewController) {
_controller.complete(webViewController);
},
我如何在flutter应用中打开WhatsApp Web桌面模式?
I want to open Whatsapp Web Desktop mode in my flutter app
As shown in picture
Required Result
I am used webview_flutter webview_flutter_plus packages but both results same.
my initial url is
The code i am using are as follow
class WhatsAppWebScreen extends StatefulWidget {
WhatsAppWebScreen({Key? key}) : super(key: key);
// late Completer<WebViewController> controller;
@override
State<WhatsAppWebScreen> createState() => _WhatsAppWebScreenState();
}
class _WhatsAppWebScreenState extends State<WhatsAppWebScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: const DrawerWidget(),
appBar: AppBar(
title: const Text("WhatsAppWeb"),
backgroundColor: Color(0xFF128D7E),
),
body: SingleChildScrollView(
child: Container(
height: 80.h,
child: WebViewPlus(
initialUrl: 'https://web.whatsapp.com',
userAgent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15",
javascriptMode: JavascriptMode.unrestricted,
),
),
),
);
}
}
Every Time i run this code the url redirects into
and results like this
I try many different user agents strings but the same result.
I used navigationdelegate parameter to prevent redirection of url. but then it shows blank screen
navigationDelegate: (request) {
if (request.url.startsWith('https://www.whatsapp.com/')) {
print('blocking navigation to $request}');
return NavigationDecision.prevent;
}
print('allowing navigation to $request');
return NavigationDecision.navigate;
},
onWebViewCreated: (webViewController) {
_controller.complete(webViewController);
},
How can i open whatsapp web desktop mode in my flutter app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)