Can I use ActiveXObject("Shell.Application") to get meta tags using DOM

Hello Experts!
I have code that creates a Shell.Application and then goes thru to identify instances of IE, and it is working great( thanks to your answers to my last question )
var objShell = new ActiveXObject("Shell.Application");
   var objShellWindows;      
   objShellWindows = objShell.Windows();
   if (objShellWindows != null) {
      for (var i = 0; i < objShellWindows.Count; i++)      {
       objIE = objShellWindows.Item(i);
        if (objIE)  // if there is an objIE, check if it is MPS page
        {
             if ( objIE.LocationURL == MPS_URL )  {  myIE = objIE.LocationURL;   }    
          var ie = new ActiveXObject( "InternetExplorer.Application" );
         ie.Navigate( objIE.LocationURL ); //LocationURL does not have a value yet
         ie.Visible = 1;
         alert("loading");  //let document load, need something like sleep
           
         doc = ie.document;
                        mtags = doc.getElementsByTagName("META");
.
......

The problem is that I need to check the values of meta tags once the page loads.  I tried to use objIE.document, but get error that document is not supported.   So, I created var ie = new ActiveXObject( "InternetExplorer.Application" ); - which I am not sure is necessary or even does what I need- to check ie.document, however when I navigate to objIE.LocationURL, that is still blank, so I cannot check the meta tags.   How can I check the meta tags, it seems like it would be the easiest part of this whole thing..
thanks!
Myra
mdolleAsked:
Who is Participating?
 
ZvonkoConnect With a Mentor Systems architectCommented:
This works for me:


<script>
   var MPS_URL = "http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_22890091.html";
   var objShell = new ActiveXObject("Shell.Application");
   var objShellWindows;      
   objShellWindows = objShell.Windows();
   if (objShellWindows != null) {
      for (var i = 0; i < objShellWindows.Count; i++)      {
        objIE = objShellWindows.Item(i);
        if (objIE){
          if( objIE.LocationURL == MPS_URL )  {
            //myIE = objIE.LocationURL;   }    
            //var ie = new ActiveXObject( "InternetExplorer.Application" );
            //ie.Navigate( objIE.LocationURL ); //LocationURL does not have a value yet
            objIE.Visible = 1;
            //alert("loading");  //let document load, need something like sleep
            doc = objIE.document;
            mtags = doc.getElementsByTagName("META");
            alert(mtags[0].outerHTML)
          }
        }
      }
    }

</script>




0
 
mdolleAuthor Commented:
thanks!  this is starting to make sense ;)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.