html2.WebView and "blocked content" on Windows/IE

Hi everyone,

My program lets people draw and customise charts. My method is using html2.WebView instance with JQuery and HighCharts. On OSX, it works really well and I’m very happy with the results.

However, on Windows, the WebView showed nothing at all. I got my program to print out the HTML code it showed and I saved it to a file (the code is below). This showed up in Chrome just as it should but in IE, I got a message box telling me that “Internet Explorer restricted this webpage from showing scripts or Active-X controls”. There was a buttons empowering me to “Allow blocked content” or close the message box.

I think this is why the WebView on Windows isn’t showing my page.

  1. Can anyone else verify this on their machine?

  2. And what would be the long term solution for this? Would I have to distribute the libraries with the program and load them locally? It doesn’t seem possible to allow the blocked content from within a wxPython program itself, at least not without lots of unnecessarily complex code.

All the best,

Alan J. Salmoni

HTML code that works on Chrome but not on WebView and only on IE if I allow it.

···
body { font-family: helvectica, arial, 'lucida sans'; }

I had similar problems recently with d3.js. In the wxWidgets manual for wxWebView (included with wxPython) there is a link to this page

I’ve put an entry in the windows registry for the IE 10 emulation and now I’m fine

hope this helps you too

Marco

···

On Tuesday, October 22, 2013 11:30:59 PM UTC+2, Alan James Salmoni wrote:

Hi everyone,

My program lets people draw and customise charts. My method is using html2.WebView instance with JQuery and HighCharts. On OSX, it works really well and I’m very happy with the results.

However, on Windows, the WebView showed nothing at all. I got my program to print out the HTML code it showed and I saved it to a file (the code is below). This showed up in Chrome just as it should but in IE, I got a message box telling me that “Internet Explorer restricted this webpage from showing scripts or Active-X controls”. There was a buttons empowering me to “Allow blocked content” or close the message box.

I think this is why the WebView on Windows isn’t showing my page.

  1. Can anyone else verify this on their machine?
  1. And what would be the long term solution for this? Would I have to distribute the libraries with the program and load them locally? It doesn’t seem possible to allow the blocked content from within a wxPython program itself, at least not without lots of unnecessarily complex code.

All the best,

Alan J. Salmoni

HTML code that works on Chrome but not on WebView and only on IE if I allow it.

body { font-family: helvectica, arial, 'lucida sans'; }

Thank you for the information Marco. It is useful after a fashion.

I’m guessing that making this registry change will affect the IE itself and not just a wx.WebView. Do you know if that’s correct?

Alan

···

On Thursday, October 24, 2013 11:44:36 PM UTC+1, Marco Prosperi wrote:

I had similar problems recently with d3.js. In the wxWidgets manual for wxWebView (included with wxPython) there is a link to this page

http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation

I’ve put an entry in the windows registry for the IE 10 emulation and now I’m fine

hope this helps you too

Marco

On Tuesday, October 22, 2013 11:30:59 PM UTC+2, Alan James Salmoni wrote:

Hi everyone,

My program lets people draw and customise charts. My method is using html2.WebView instance with JQuery and HighCharts. On OSX, it works really well and I’m very happy with the results.

However, on Windows, the WebView showed nothing at all. I got my program to print out the HTML code it showed and I saved it to a file (the code is below). This showed up in Chrome just as it should but in IE, I got a message box telling me that “Internet Explorer restricted this webpage from showing scripts or Active-X controls”. There was a buttons empowering me to “Allow blocked content” or close the message box.

I think this is why the WebView on Windows isn’t showing my page.

  1. Can anyone else verify this on their machine?
  1. And what would be the long term solution for this? Would I have to distribute the libraries with the program and load them locally? It doesn’t seem possible to allow the blocked content from within a wxPython program itself, at least not without lots of unnecessarily complex code.

All the best,

Alan J. Salmoni

HTML code that works on Chrome but not on WebView and only on IE if I allow it.

body { font-family: helvectica, arial, 'lucida sans'; }

the registry entry for your program (substitute contoso.exe with your exe name) determines how your program will use IE 10 engine (emulating a previous IE version or using all recent features available in IE 10). Other programs or browser navigation will not be affected. If you distribute your application you must check that your user has a recent IE version and that the registry is correctly configured (your installer could set it up)

Marco

···

On Monday, October 28, 2013 2:52:13 PM UTC+1, Alan James Salmoni wrote:

Thank you for the information Marco. It is useful after a fashion.

I’m guessing that making this registry change will affect the IE itself and not just a wx.WebView. Do you know if that’s correct?

Alan

On Thursday, October 24, 2013 11:44:36 PM UTC+1, Marco Prosperi wrote:

I had similar problems recently with d3.js. In the wxWidgets manual for wxWebView (included with wxPython) there is a link to this page

http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation

I’ve put an entry in the windows registry for the IE 10 emulation and now I’m fine

hope this helps you too

Marco

On Tuesday, October 22, 2013 11:30:59 PM UTC+2, Alan James Salmoni wrote:

Hi everyone,

My program lets people draw and customise charts. My method is using html2.WebView instance with JQuery and HighCharts. On OSX, it works really well and I’m very happy with the results.

However, on Windows, the WebView showed nothing at all. I got my program to print out the HTML code it showed and I saved it to a file (the code is below). This showed up in Chrome just as it should but in IE, I got a message box telling me that “Internet Explorer restricted this webpage from showing scripts or Active-X controls”. There was a buttons empowering me to “Allow blocked content” or close the message box.

I think this is why the WebView on Windows isn’t showing my page.

  1. Can anyone else verify this on their machine?
  1. And what would be the long term solution for this? Would I have to distribute the libraries with the program and load them locally? It doesn’t seem possible to allow the blocked content from within a wxPython program itself, at least not without lots of unnecessarily complex code.

All the best,

Alan J. Salmoni

HTML code that works on Chrome but not on WebView and only on IE if I allow it.

body { font-family: helvectica, arial, 'lucida sans'; }

It was part of the problem! I’m writing so that this is captured.

Using Python 2.7 with wxPython 2.9. Webkit (on OSX) displayed HTML content easily and without problem. On Windows, nothing was displayed though the HTML was okay.

Solution:

  1. Get IE to emulate a later version by changing the registry (thanks Marco):

import _winreg as wreg

current_file = file

key = wreg.CreateKey(wreg.HKEY_CURRENT_USER, “Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION”)

wreg.SetValueEx(key, current_file, 0, wreg.REG_DWORD, 10001)

Change 10001 to whatever version of IE needed (as per Internet Feature Controls (B..C) (Internet Explorer))

  1. Load files via the LoadURL() method rather than SetPage() method and load additional files (e.g., JQuery) locally too.

Now I can render HighCharts in WebView on Windows. :slight_smile:

Alan

···

On Monday, October 28, 2013 3:03:49 PM UTC, Marco Prosperi wrote:

the registry entry for your program (substitute contoso.exe with your exe name) determines how your program will use IE 10 engine (emulating a previous IE version or using all recent features available in IE 10). Other programs or browser navigation will not be affected. If you distribute your application you must check that your user has a recent IE version and that the registry is correctly configured (your installer could set it up)

Marco

On Monday, October 28, 2013 2:52:13 PM UTC+1, Alan James Salmoni wrote:

Thank you for the information Marco. It is useful after a fashion.

I’m guessing that making this registry change will affect the IE itself and not just a wx.WebView. Do you know if that’s correct?

Alan

On Thursday, October 24, 2013 11:44:36 PM UTC+1, Marco Prosperi wrote:

I had similar problems recently with d3.js. In the wxWidgets manual for wxWebView (included with wxPython) there is a link to this page

http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation

I’ve put an entry in the windows registry for the IE 10 emulation and now I’m fine

hope this helps you too

Marco

On Tuesday, October 22, 2013 11:30:59 PM UTC+2, Alan James Salmoni wrote:

Hi everyone,

My program lets people draw and customise charts. My method is using html2.WebView instance with JQuery and HighCharts. On OSX, it works really well and I’m very happy with the results.

However, on Windows, the WebView showed nothing at all. I got my program to print out the HTML code it showed and I saved it to a file (the code is below). This showed up in Chrome just as it should but in IE, I got a message box telling me that “Internet Explorer restricted this webpage from showing scripts or Active-X controls”. There was a buttons empowering me to “Allow blocked content” or close the message box.

I think this is why the WebView on Windows isn’t showing my page.

  1. Can anyone else verify this on their machine?
  1. And what would be the long term solution for this? Would I have to distribute the libraries with the program and load them locally? It doesn’t seem possible to allow the blocked content from within a wxPython program itself, at least not without lots of unnecessarily complex code.

All the best,

Alan J. Salmoni

HTML code that works on Chrome but not on WebView and only on IE if I allow it.

body { font-family: helvectica, arial, 'lucida sans'; }

Alan James Salmoni wrote:

It was part of the problem! I'm writing so that this is captured.

Using Python 2.7 with wxPython 2.9. Webkit (on OSX) displayed HTML
content easily and without problem. On Windows, nothing was displayed
though the HTML was okay.

Solution:

1. Get IE to emulate a later version by changing the registry (thanks
Marco):

import _winreg as wreg
current_file = __file__
key = wreg.CreateKey(wreg.HKEY_CURRENT_USER,
"Software\\Microsoft\\Internet
Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION")
wreg.SetValueEx(key, current_file, 0, wreg.REG_DWORD, 10001)

Change 10001 to whatever version of IE needed (as per
Internet Feature Controls (B..C) (Internet Explorer))

2. Load files via the LoadURL() method rather than SetPage() method and
load additional files (e.g., JQuery) locally too.

Now I can render HighCharts in WebView on Windows. :slight_smile:

Thanks for the update.

···

--
Robin Dunn
Software Craftsman