Missing references in html2 webview

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Missing references in html2 webview

tvonnardroff
Hi,

I am building GUI components around wx/html2/webview. I'm doing this with Python 2.7, wx 4.0.0b2, and I am testing on Windows 10.

I want to be able to load the WebView with data content from Python using SetPage.

To test I have a basic html/javascript web page in a utf-8 encoded file. I load the data from the file directly into WebView.SetPage, and I test the same data using MS Edge with the file URI. Everything is local to my desktop PC.

On the surface it works beautifully, with CSS and HTML I get the same results via both methods and they fully work. However once I start trying to write JavaScript I immediately see that there are references that Edge knows about that WebView does not, even though WebView *seems* to be using the Edge back end.

The first example where I see this fail is <script>var ws = new WebSocket(...)</script>

This works fine in Edge with no additional script links, but WebView complains "WebSocket is undefined". Trying to inline these missing references quickly leads to cascading problems.

Can someone please explain why there is a difference in the runtime env between the two, and also is it actually feasible to write complex JavaScript or use off-the-shelf JS libs when using this method? (I haven't seen a lot of examples online), and if not, what recommendations does anyone have for a better approach?

Many Thanks.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Missing references in html2 webview

Scott Talbert
On Tue, 13 Feb 2018, [hidden email] wrote:

> Hi,
> I am building GUI components around wx/html2/webview. I'm doing this with
> Python 2.7, wx 4.0.0b2, and I am testing on Windows 10.
>
> I want to be able to load the WebView with data content from Python using
> SetPage.
>
> To test I have a basic html/javascript web page in a utf-8 encoded file. I
> load the data from the file directly into WebView.SetPage, and I test the
> same data using MS Edge with the file URI. Everything is local to my
> desktop PC.
>
> On the surface it works beautifully, with CSS and HTML I get the same
> results via both methods and they fully work. However once I start trying
> to write JavaScript I immediately see that there are references that Edge
> knows about that WebView does not, even though WebView *seems* to be using
> the Edge back end.
>
> The first example where I see this fail is <script>var ws = new
> WebSocket(...)</script>
>
> This works fine in Edge with no additional script links, but WebView
> complains "WebSocket is undefined". Trying to inline these missing
> references quickly leads to cascading problems.
>
> Can someone please explain why there is a difference in the runtime env
> between the two, and also is it actually feasible to write complex
> JavaScript or use off-the-shelf JS libs when using this method? (I haven't
> seen a lot of examples online), and if not, what recommendations does
> anyone have for a better approach?

I am not super familiar with the WebView implementation for Windows, but I
believe that it uses the IE backend (perhaps an older version).

Scott

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.