Get contents from href and set it into an iframe - Javascript jQuery

Javascript examples for jQuery:iframe

Description

Get contents from href and set it into an iframe

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from   ww  w  .j ava2 s.  c o  m
$('body').append('<iframe width="100%" class="chat-iframe" src="' + $('a').prop('href') + '"></iframe>')
    }

      </script> 
   </head> 
   <body> 
      <a href="your url">Chat With Emma</a>  
   </body>
</html>

Related Tutorials