Welcome Guest Search | Active Topics | Sign In | Register

WebBrowserControl - Get Javascript ,css, images of an HTML page Options
Ron
Posted: Monday, December 15, 2014 5:14:27 AM
Rank: Newbie
Groups: Member

Joined: 11/30/2014
Posts: 6
Is there a way to get related javacripts , css files content after an HTML page was loaded?

We can get the related file names through the BeforeRequestLoad event but we want their content.

we checked the WebView_AfterReceiveHeaders which was the closed way we found to get files data but the response.outputstream is not available.
eo_support
Posted: Monday, December 15, 2014 8:14:06 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi,

You won't be able to get that directly through any EO.WebBrowser interface. The file contents goes from the network layer straight to parser (for performance reason), it does not pass intermediate layers.

One way you can do it is to get the Url of the file (for example, by examining the script element's src property with JavaScript), then uses a XmlHttpRequest object to fetch the file contents yourself. You will need to write some JavaScript code to perform this task, then call WebView.EvalScript to run the script inside the WebView.

Thanks!
Ron
Posted: Monday, December 15, 2014 1:54:40 PM
Rank: Newbie
Groups: Member

Joined: 11/30/2014
Posts: 6
I think we can use the BeforeRequestLoad , get the URLs and then load the files with our code.

Is this event raised when a file is downloaded when javascript code asks for it. For example a javascript method which uses ajax get of a file?
eo_support
Posted: Monday, December 15, 2014 11:27:20 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi,

You should not use BeforeRequestLoad for that purpose. You can use a custom resource handler for that purpose. The custom resource handler will capture everything you want to capture and allow you to override any contents you wish. See here for more details on how to use this feature:

http://www.essentialobjects.com/doc/6/advanced/resource_handler.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.