[Gambas-user] WebView - How to show images?
Bruce Steers
bsteers4 at gmail.com
Thu Feb 17 11:32:51 CET 2022
On Thu, 17 Feb 2022 at 09:56, Martin Belmonte <mbelmonte at belmotek.net>
wrote:
> El 16/2/22 a las 22:11, vuott--- via User escribió:
> > Fabien's suggestion works for me; but it works using QT, not by using
> GTK.
> In my case it has not worked for any of the following components:
> gb.gui + gb.gui.webview
> gb.qt5 + gb.qt5.webview
>
> This code is for test:
>
> Private sWebForeground As String
> Private sWebBackground As String
>
> Public Sub Form_Open()
> Dim sContent As String
> ' I use this image file
> '"wget
> https://upload.wikimedia.org/wikipedia/commons/0/0d/Asymmetricwave2.png"
>
> sWebForeground = "#" & Hex(Color.Foreground, 6)
> sWebBackground = "#" & Hex(Color.Background, 6)
>
> sContent = "<html><head></head><body style=\"color:" & sWebForeground
> & "; background-color:" & sWebBackground & "; word-wrap: break-word;
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;\">\n"
> sContent &= File.Load("./content.txt")
> sContent &= "</body></html>"
>
> WebView1.SetHtml(sContent)
>
> End
>
> then content.txt content is:
>
> <h2>Electron</h2>
> <p>The electron is a subatomic ...</p>
> <img width="400" alt="test" src="/tmp/Asymmetricwave2.png"></img>
>
I tried your code and found this...
With GTk i was clueless as to why its not working.
With QT i got this error message...
*js: Not allowed to load local resource: file:///tmp/Asymmetricwave2.png*
Can't seem to enable it
And used the above code so have not used any JS as far as i can see, it
must be internal.
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220217/362c34d3/attachment.htm>
More information about the User
mailing list