get url from iframe - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

get url from iframe

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript">
        function load() {/*from  ww  w . j a  v  a 2s . c  o m*/
            var url =  document.getElementById("iframeid").src;
            console.log(url);
        }
    
      </script> 
   </head> 
   <body> 
      <iframe onload="load()" 
              name="Google" 
              id="iframeid" 
              scrolling="auto" 
              style="width:95%;height:600px" src="http://www.java2s.com"> hi </iframe>  
   </body>
</html>

Related Tutorials