Cancel a link event in iframe that has a target="_parent" attribute with sandbox attribute - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

Cancel a link event in iframe that has a target="_parent" attribute with sandbox attribute

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <iframe sandbox="allow-forms allow-scripts allow-same-origin"></iframe> 
      <script>

    frames[0].document.write( '<html><body><a href="http://java2s.com" target="_parent">test</a></body></html>' );

      </script>  
   </body>//w  w w.  j  a va2 s  .  c  o  m
</html>

Related Tutorials