[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2007-10-12
2
Medium Priority
?
1,390 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:mdolle
2 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 20068123
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
 

Author Comment

by:mdolle
ID: 20068625
thanks!  this is starting to make sense ;)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question