我用的是离子电容器。构建后,iOS中的webview没有打开外部链接。xcode调试时没有错误或警告消息。但是,它在浏览器和Android上运行良好。我错过了什么?
在index.html中
<meta http-equiv="Content-Security-Policy"
content="gap: wss: ws: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';">
WebView配置:
import { InAppBrowser } from '@ionic-native/in-app-browser';
var browser = InAppBrowser.create( wpcUrl, "_blank",
{
location: 'no', //Or 'no'
hardwareback: 'yes',
mediaPlaybackRequiresUserAction: 'yes',
closebuttoncaption: 'Share', //iOS only
disallowoverscroll: 'no', //iOS only
toolbar: 'yes', //iOS only
toolbarposition: 'bottom',
enableViewportScale: 'no', //iOS only
allowInlineMediaPlayback: 'no', //iOS only
presentationstyle: 'formsheet', //iOS only
}
);
我也尝试了target _blank、_system和_self,但问题相同。
注意:我在它的根目录下没有任何config.xml文件,我只有一个manifest.json,看起来像这样:
{
"short_name": "WPCafe App",
"name": "My WPCafe App",
"icons": [
{
"src": "assets/icon/favicon.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "assets/icon/icon.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#ffffff",
"background_color": "#ffffff"
}
1条答案
按热度按时间2hh7jdfx1#
这是URL问题。您可以使用encodeURI方法对URL进行编码: