1. Alex Mavrishchev
  2. PowerBuilder
  3. Wednesday, 24 November 2021 18:13 PM UTC

Hello,

Is it possible to pass HTML as a string directly to WebBrowser object instead of saving HTML into the file and then opening that file?

Daryl Foster Accepted Answer Pending Moderation
  1. Thursday, 25 November 2021 00:14 AM UTC
  2. PowerBuilder
  3. # 1

Hi Alex, you could try something like the commands below and see how you go. I played around with them a while ago and they "sort" of worked. I think from memory I had to escape double quotes in the html as \".  And it doesn't automatically follow links to download images etc like the old MS OLE webbrowser did when you set the html using Object.Document.Write(ls_signature), but it might give you a place to start.

 

wb_1.EvaluateJavascriptSync('document.body.innerHTML="<H1>Some sample html</H1>";')
wb_1.EvaluateJavascriptSync('document.documentElement.outerHTML="<HTML><H1>Some sample html</H1></HTML>";')

 

Comment
There are no comments made yet.
Alex Mavrishchev Accepted Answer Pending Moderation
  1. Wednesday, 24 November 2021 19:29 PM UTC
  2. PowerBuilder
  3. # 2

Hi Matt,

This case is clear. While the question is in passing HTML instead of the URL.

Let's say we have some HTML like "<HTML><H1>Some sample html</H1></HTML>". At the moment we save this into sample.html file and use Navigate("sample.html") to browse this file. While the goal is to avoid the step of saving secure information on hdd and pass dynamic HTML directly to the WebBrowser. Is there any workaround for this?

Thanks,
Alex

Comment
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Wednesday, 24 November 2021 19:18 PM UTC
  2. PowerBuilder
  3. # 3

From the help:

Integer li_rtn
li_rtn = wb_1.Navigate("http://www.appeon.com")


Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.