Flutter url_launcher 阻止弹出窗口
我想将用户从 flutter web 应用程序重定向到另一个网址。
我将 url_launcher 与以下代码一起使用:
if(await canLaunch(link)){
await launch(link);
}else{
print('faild to load url');
}
此代码在我的应用程序的其他页面中运行良好。但在其中一个页面中无法工作,并且我的浏览器中的弹出窗口被阻止
。
该代码在 Chrome(桌面和移动设备)上运行良好。但问题发生在 safari 上。
更新:在出现问题的页面中,我有一个 http 请求,然后启动该 url。
var url = Uri.parse(Api.completeOrder);
var response = await http.post(url, body: {
'token': token,
});
if (response.statusCode == 200) {
if(await canLaunch(link)){
await launch(link);
}else{
print('faild to load url');
}
}
I want to redirect user from flutter web app to another url.
I use url_launcher with the following code:
if(await canLaunch(link)){
await launch(link);
}else{
print('faild to load url');
}
this code is working fine in other pages of my application. but not working in one of the pages and i get popup window blocked
in my browser.
the code is working fine on chrome(desktop and mobile). but the problem occurs on safari.
update: in the page where the problem is occuring I have a http request and then launch the url.
var url = Uri.parse(Api.completeOrder);
var response = await http.post(url, body: {
'token': token,
});
if (response.statusCode == 200) {
if(await canLaunch(link)){
await launch(link);
}else{
print('faild to load url');
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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