Welcome Guest Search | Active Topics | Sign In | Register

Load HTML content (no url) with all external resources Options
Khoa
Posted: Friday, May 22, 2015 5:48:49 PM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Hi,

I would like to load a virtual page (no physical url) using webView.LoadHtml(htmlContent). However, this HTML content has .js and .css references as relative links, for example <script src="jquery.js"></script>

Those js/css references will not load as the web view does not load a real url, then it does not know where to get those files. I don't want to set the absolute link, for example <script src="http://code.jquery.com/jquery.js"></script>, because I don't want to put the whole link on the code.

How to set the web view to run under a certain domain (http://code.jquery.com/ in this example) without actual load it? So webView.LoadHtml(htmlContent) will load all needed external resources.

Thank you.
eo_support
Posted: Friday, May 22, 2015 6:00:19 PM
Rank: Administration
Groups: Administration

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

You would need to set HtmlToPdf.Options.BaseUrl for that. At runtime, EO.Pdf combines this BaseUrl value with the partial Url in your page to form the full Url.

Thanks!
Khoa
Posted: Friday, May 22, 2015 10:18:14 PM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Thank you for your reply. My question is for EO.WebBrowser, not for EO.Pdf
eo_support
Posted: Sunday, May 24, 2015 12:12:07 PM
Rank: Administration
Groups: Administration

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

In that case you can use custom resource handler:

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

Thanks!
Khoa
Posted: Monday, May 25, 2015 8:20:34 AM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Custom resource handler does help. Thank you.


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.