#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Get content from iframe


    down vote favorite


    I'd like to get the security zone (Internet zone / local intranet) for a number of URL's which are in the same domain. I thought the best solution would be to get this through iFrame. But I don't know how to call a function with iframe in my code example. I know that this command is not possible: value[i] = frames[i].isTrustedIE()

    So could you give me the missing puzzle that the code will work ?
    Many Thanks

    Code:
    <html> <head> <script type="text/javascript">  function isTrustedIE(){ try{     new ActiveXObject("Scripting.FileSystemObject"); } catch(e){     return false; //untrusted }  return true; //trusted }  function getZone() {      var value = new Array();     var text = new Array();     var frameNames = document.getElementsByClass('iframeNames');       for(var i = 0; i < frameNames.length; i++) {           value[i] = frames[i].isTrustedIE();              if(value[i] == true) {                  text[i] = "Trusted (Local Intranet)";              }else {                 text[i] =  "Untrusted (Internet Zone)";                                }           } //end for   var showText = getElementsByClass("zone"); for(var i = 0; i < showText.length; i++) {     setText(showText[i], text[i]); };       } //end getZone()   function setText(showText, text) {       showText.innerHTML = text;       } //end setText   if(document.getElementsByClassName) {      getElementsByClass = function(classList, node) {                 return (node || document).getElementsByClassName(classList);         };  }   </script>  </head>   <style type="text/css">  tr:nth-child(2n) { background-color: #ddd; }  .format {background-color: #ffff;}  #formatierung { margin-left: 10px; margin-top: 30px; font-family: Arial; font-size: 13px;  }  </style>  <body>  <iframe src = "http://example.com" class = "iframeNames" width = "0"  height ="0"></iframe> <iframe src = "http://example.com/index/" class = "iframeNames" width = "0"  height =  "0"></iframe>  <script type = "text/javascript"> window.onload = function() {  getZone();  }; </script>   <div id = "formatierung">  <table width = "100%">   <tr class = "format"><td><h2>System</h2></td><td><h2>Check Security-Zone</h2></td></tr> <tr><td>example1</td><td class = "zone"></td></tr> <tr><td>example2</td><td class = "zone"></td></tr>  </table> </div>   </body> </html>
  2. #2
  3. JavaScript is not spelt java
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2011
    Location
    Landan, England
    Posts
    743
    Rep Power
    165
    Code:
    document.getElementById('iframeid').contentWindow.isTrustedIE();
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by AndrewSW
    Code:
    document.getElementById('iframeid').contentWindow.isTrustedIE();
    But this didn't work. I've got a number of iFrames. And these are in a class!!!

IMN logo majestic logo threadwatch logo seochat tools logo