阻止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"...