I am trying to get read access to a <META> tag in an HTML document in IE 6.x, using client-side JavaScript. I can’t seem to find a way or any reference to the Content of the tag. Anyone seen any JavaScript code that can do this? Again, this is running in IE 6.x
@tjmatauthorJan 13.2003 — #Gil. Thanks for the info. It works great for my main window. However it leads to my next dilema:
What I am working with is the document of a popup window: as in window.CreatePopup(); I'm trying to look at the <meta> tag of the content of the Popup window. It doesn't seem to have any meta tags or, for that matter, any content in the <head> section. Using GetElementsByTagName("META") in the popup document yields an object with zero length. Same for "title". I'm afraid that IE has some kind of special handling for the content of a Popup. Any thoughts?
@AntithesisJan 15.2003 — #My guess is that you aren't refrencing the window itself. You need to give it a variable name...the following code worked for me:
var foo = window.open("", "", "");
foo.document.write('<meta>');
var bar = foo.document.getElementsByTagName('meta');
bar was an array with a length of one...if you don't get anything meaningful out of that, then post a link or the code and I'll see what I can do.
@tjmatauthorJan 15.2003 — #Antithesis: Here is some of the code:
var oPopup = window.createPopup();
function onDoneDown(src){
oPopup.document.body.innerHTML = src;
<!-- get META tag here -->
oPopup.show(lefter, toper + 7, 170, 150);
}
function openToolTip(aSrc, aX, aY)
{
dwn.startDownload("help/" + aSrc, onDoneDown);
lefter = event.screenX + aX + 12;
toper = event.screenY + aY + 15;
}
It got lost in the shuffle, but I'm working with a Popup object, which has a document property but, for some reason doesn't seem to have META tags, even thought the source document code (aSrc in the code) definitely has META tags. I would like to extract info from the source document, which is contained in the META tags.
@tjmatauthorJan 15.2003 — #Gil, I think you have identified the problem: I'm only loading the BODY, and the HEAD never gets loaded with innerHTML. Unfortunately for me, document.head.innerHTML is not a valid property, though. Nor is document.innerHTML a valid property. It looks like I need to find a different way to load the src document into the popup.