admin管理员组文章数量:1426479
I'm trying to set up an app that uses a WebView (flutter_webview on pub) on Android and redirects directly on web, as flutter_webview does not work on web. I looked into js on pub and dart:js but that does not work, as Android doesn't allow dart:js or package:js to be imported at all. Any ideas? I'm using kIsWeb to detect the platform (not offering iOS or Desktop).
I'm trying to set up an app that uses a WebView (flutter_webview on pub) on Android and redirects directly on web, as flutter_webview does not work on web. I looked into js on pub and dart:js but that does not work, as Android doesn't allow dart:js or package:js to be imported at all. Any ideas? I'm using kIsWeb to detect the platform (not offering iOS or Desktop).
Share Improve this question asked May 9, 2021 at 17:09 samuelbeepsamuelbeep 152 silver badges5 bronze badges2 Answers
Reset to default 3When in web, just create a method like this:
import 'dart:html' as html;
void openInWindow(String uri, String name) {
html.window.open(uri, name);
}
and use it like this:
print('heading over to... $uri');
openInWindow(uri.toString(), '_self');
import 'dart:html' as html; dont forget this import for previous solution
本文标签: javascriptRedirect only on Flutter WebStack Overflow
版权声明:本文标题:javascript - Redirect only on Flutter Web - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745423997a2658028.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论