View Full Version : Raw/source html webpage
10-08-2008, 07:22 AM
AIR can load a webpage using the HTMLLoader class which is a DisplayObject (or the HTML component of Flex). But is there a way to get the raw html source of the webpage that was loaded? I've spent hours now looking for how to get the page source. Any help?
10-09-2008, 07:43 AM
well....this gives me an interpreted HTML source...but I want the raw source.
var dom:Object = _htmlLoader.window.document;
var source:String = dom.documentElement.outerHTML;
10-17-2008, 12:17 PM
the only way i kno of is to load the page again using a URLLoader. I kno that isnt near perfect but it works. i like the innerHTML/outerHTML way better
10-17-2008, 04:53 PM
what do you mean load the page AGAIN? can you give a code sample?
10-17-2008, 04:56 PM
My guess is that use HTMLLoader to load and display it on the stage, and use URLLoader with the same URL to get the raw source code??
10-18-2008, 06:25 AM
yup. CB knows what im talkin about.
10-18-2008, 09:47 AM
i don't understand. Can i see an example?
thanks guys :)
10-18-2008, 08:40 PM
var url:String = htmlLoader.location;
var urlReq:URLRequest = new URLRequest(url);
var loader:URLLoader = new URLLoader(urlReq);
10-18-2008, 10:31 PM
So I guess there is no "secret" property of HTMLLoader has has a URLLoader object that I can directly access. I guess that works.
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.