Discussion:
html2.WebView and "blocked content" on Windows/IE
Alan James Salmoni
2013-10-22 21:30:59 UTC
Permalink
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.

<!DOCTYPE html>
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="/js/themes/gray.js"></script>
<style>
body { font-family: helvectica, arial, 'lucida sans'; }
</style>
</head>
<body>
<div id="chart0001" style="width:100&amp; height: auto;">
<script type="text/javascript">
$(function () {
$("#chart0001").highcharts({
chart: {
type: "area" },
title: {
},
subtitle: {
},
xAxis: {
categories: ["1.0","2.0"],
},
yAxis: {
title: { text: "y axis" }
},
legend: {
align: "do not show",
verticalAlign: "bottom",
enabled: false,
},
series: [{
name: "B",
data: [7.0,40.0]
}, ]
});
});
</script>
</div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Marco Prosperi
2013-10-24 22:44:36 UTC
Permalink
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
Post by Alan James Salmoni
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.
<!DOCTYPE html>
<html>
<head>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="/js/themes/gray.js"></script>
<style>
body { font-family: helvectica, arial, 'lucida sans'; }
</style>
</head>
<body>
<div id="chart0001" style="width:100&amp; height: auto;">
<script type="text/javascript">
$(function () {
$("#chart0001").highcharts({
chart: {
type: "area" },
title: {
},
subtitle: {
},
xAxis: {
categories: ["1.0","2.0"],
},
yAxis: {
title: { text: "y axis" }
},
legend: {
align: "do not show",
verticalAlign: "bottom",
enabled: false,
},
series: [{
name: "B",
data: [7.0,40.0]
}, ]
});
});
</script>
</div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Alan James Salmoni
2013-10-28 13:52:13 UTC
Permalink
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
Post by Marco Prosperi
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
Post by Alan James Salmoni
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.
<!DOCTYPE html>
<html>
<head>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="/js/themes/gray.js"></script>
<style>
body { font-family: helvectica, arial, 'lucida sans'; }
</style>
</head>
<body>
<div id="chart0001" style="width:100&amp; height: auto;">
<script type="text/javascript">
$(function () {
$("#chart0001").highcharts({
chart: {
type: "area" },
title: {
},
subtitle: {
},
xAxis: {
categories: ["1.0","2.0"],
},
yAxis: {
title: { text: "y axis" }
},
legend: {
align: "do not show",
verticalAlign: "bottom",
enabled: false,
},
series: [{
name: "B",
data: [7.0,40.0]
}, ]
});
});
</script>
</div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Marco Prosperi
2013-10-28 15:03:49 UTC
Permalink
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
Post by Alan James Salmoni
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
Post by Marco Prosperi
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
Post by Alan James Salmoni
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.
<!DOCTYPE html>
<html>
<head>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="/js/themes/gray.js"></script>
<style>
body { font-family: helvectica, arial, 'lucida sans'; }
</style>
</head>
<body>
<div id="chart0001" style="width:100&amp; height: auto;">
<script type="text/javascript">
$(function () {
$("#chart0001").highcharts({
chart: {
type: "area" },
title: {
},
subtitle: {
},
xAxis: {
categories: ["1.0","2.0"],
},
yAxis: {
title: { text: "y axis" }
},
legend: {
align: "do not show",
verticalAlign: "bottom",
enabled: false,
},
series: [{
name: "B",
data: [7.0,40.0]
}, ]
});
});
</script>
</div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Alan James Salmoni
2014-04-09 11:57:30 UTC
Permalink
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 http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation)

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. :-)

Alan
Post by Marco Prosperi
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
Post by Alan James Salmoni
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
Post by Marco Prosperi
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
Post by Alan James Salmoni
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.
<!DOCTYPE html>
<html>
<head>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js
"></script>
<script src="/js/themes/gray.js"></script>
<style>
body { font-family: helvectica, arial, 'lucida sans'; }
</style>
</head>
<body>
<div id="chart0001" style="width:100&amp; height: auto;">
<script type="text/javascript">
$(function () {
$("#chart0001").highcharts({
chart: {
type: "area" },
title: {
},
subtitle: {
},
xAxis: {
categories: ["1.0","2.0"],
},
yAxis: {
title: { text: "y axis" }
},
legend: {
align: "do not show",
verticalAlign: "bottom",
enabled: false,
},
series: [{
name: "B",
data: [7.0,40.0]
}, ]
});
});
</script>
</div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Robin Dunn
2014-04-18 00:29:21 UTC
Permalink
Post by Alan James Salmoni
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.
1. Get IE to emulate a later version by changing the registry (thanks
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
http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation)
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. :-)
Thanks for the update.
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...