禁止iframe内的页面跳转

转载:https://blog.csdn.net/xtgefzhangqing/article/details/64924063

代码:


  
  
  1. <iframe name= "son" src= "https://www.hao123.com" width= "100%" height= "100%" scrolling= "auto" security= "restricted" sandbox= "allow-top-navigation allow-same-origin allow-forms allow-scripts">
  2. </iframe>



sandbox 属性

"" 应用以下所有的限制。
allow-same-origin 允许 iframe 内容被视为与包含文档有相同的来源。
allow-top-navigation 允许 iframe 内容从包含文档导航(加载)内容。
allow-forms 允许表单提交。
allow-scripts 允许脚本执行。




猜你喜欢

转载自blog.csdn.net/sinat_38818576/article/details/83615009