We help IT Professionals succeed at work.
Get Started

processing mhtml in javascript

chadnash1
chadnash1 asked
on
1,287 Views
Last Modified: 2013-12-08
using ie 6

I have an IFrame with the src being a mhtml file
I want to have java script to access the objects of the mhtml file but cant
I can getto the IFrame and to the ontentWindow of the IFrame but cant get inside the contentwindow at all

attached is the things I tried

Thanks Chad

<html>
<body>
 
aa
<iframe name="iframename" id="iframeid" src="Hi.mht">
 
</iframe>
<script>
function stuff()
{
 
 
	var iframe = document.getElementById("iframeid");
	alert(iframe.name);
 
	var iframeW = iframe.contentWindow
	alert(iframeW);
	var frames=iframeW.frames;
	alert("FRAMES=" +frames);
	alert("frames.length=" +frames.length);
 
	//alert("iframeW.external="+iframeW.external);
	alert("iframeW.behaviorUrns="+iframeW.behaviorUrns);
 
	alert("iframeW.all="+iframeW.all);
	//alert("iframeW.all.length="+iframeW.all.length);
	alert("iframeW.length="+iframeW.length);
	alert("iframeW.contents="+iframeW.contents);
	var temp = "";
	var obj = iframeW;
	for (x in obj)
	        //{temp += x + ": " + obj[x] + "\n";}
	        {temp += x + "\n";}
	alert (temp);
	alert("iframeW.window="+iframeW.window);
	temp = "";
	obj = iframeW.window;
		for (x in obj)
		        //{temp += x + ": " + obj[x] + "\n";}
		        {temp += x + "\n";}
	alert (temp);
	alert("iframeW.window.document="+iframeW.window.document);
	alert("iframeW.document="+iframeW.document);
 
	var iframedoc = iframeW.document;
 
	alert(" hi1 ");
	alert(iframedoc);
	alert(" hi2 ");
	alert(iframe);
	alert("iframe.childNodes" + iframe.childNodes);
	alert(iframe.childNodes.length);
	var i;
	for(i = 0 ; i<=iframe.childNodes.length;i++)
	{
	 alert(iframe.childNodes(i));
	 alert("<br />");
	}
	alert(" hi3 ");
 
	alert(iframedoc.body);
	alert(iframedoc.anchors.length);
 
	for(i = 0 ; i<=iframedoc.anchors.length;i++)
	{
	 alert(iframedoc.anchors(i));
	 alert("<br />");
	}
 
}
 
stuff();
//var t= setTimeout("stuff();",1000);
</script>
 
</body>
</html>

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE