阻止iframe中的链接导航/接pipecordova webview,特别是在ios中
我有cordova应用程序显示外部内容与iframe(在这种情况下youtubeembedded式video)
点击iframe中的链接(如youtube徽标)时,整个webview将导航到youtube网站,而不仅仅是iframe。 (没有能力回去,你需要杀死应用程序),我想阻止的行为。
在android上,cordova插件API暴露onOverrideUrlLoading方法,它应该能够阻止不需要的导航。 (自己还没有testing过)
我还没有find类似的方法在ioscordova类,也没有在ios webview API。 但我不是很熟悉ios。
我也试过(在android&ios上)iframe的沙箱属性https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe#attr-sandbox这适用于防止脚本(不是我需要atm,只是为了检查属性是否在做什么)而不是阻止导航(为了启用导航,您应该添加allow-top-navigation,而我没有)
使用html5沙箱属性,而不允许允许顶部导航和允许popup窗口
<iframe sandbox="allow-scripts allow-same-origin"...
testing:ios 8 / 7.1,android 4.4
在我以前的检查中,我已经添加了允许popup窗口的沙箱价值
<iframe sandbox="allow-scripts allow-same-origin allow-popups"...
- 将使用相机拍摄的照片捕获并存储到本地数据库/ PhoneGap / Cordova / iOS中
- cordovaiOSvideo标签本地文件源
- iOS中的链接Ionic应用程序不能立即打开
- iOS中的Google日历应用urlscheme
- Cordova应用程序无法在iOS 9上selectinput字段
- VS2013 Cordova iOS Remotebuild错误无法POST /build/tasks?command=build&vcordova=4.3.1&cfg=debug
- Phonegap 2.6与KeyboardShrinksView和HideKeyboardFormAccessoryBar
- IONIC / cordova,在IOS中打电话
- Objective-C vs PhoneGap