Re: Limited JavaScript functionality in MSW with wx.html2

Dan Cutright <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
I received the following message in my email, but doesn't appear to be 
actually posted?

Check that IE is v.11 and use registry to set compatibility mode to IE 11.
>
> Niki


I have done that, but it does not enable all of the JS features apparently, 
below is the code I use to accomplish that.  If my application user is on 
windows, I call set_ie_emulation_level and set_ie_lockdown_level. Now it's 
possible the IE emulator simply has some JS issues I can't overcome and 
perhaps the loaded javascript itself needs to be changed?  But I'd need the 
JS console output to figure that out.

I have posted on wx-users (topic: Limited JavaScript functionality in MSW 
with wx.html2), but no advice posted yet.
https://groups.google.com/forum/#!topic/wx-users/6sy4AFl_xHY


import winreg
import sys
from os.path import basename


def set_reg(name, reg_path, value):
    try:
        winreg.CreateKey(winreg.HKEY_CURRENT_USER, reg_path)
        registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, reg_path, 0, winreg.KEY_WRITE)
        winreg.SetValueEx(registry_key, name, 0, winreg.REG_DWORD, value)
        winreg.CloseKey(registry_key)
        return True
    except WindowsError:
        return False

def set_ie_emulation_level(value=11001):
    # See this site for information on which values to use
    # https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85)#browser_emulation
    reg_path = r"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
    set_reg(basename(sys.executable), reg_path, value)


def set_ie_lockdown_level(value=0):
    # Based on info from Venkatakrishnan at
    # https://stackoverflow.com/questions/44513580/powershell-how-to-allow-blocked-content-in-internet-explorer/44514051
    reg_path = r"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN"
    set_reg(basename(sys.executable), reg_path, value)




On Friday, January 31, 2020 at 4:38:30 PM UTC-6, Dan Cutright wrote:
>
> Thank for your quick reply Scott!
>
> I've noticed the Edge-based webview as well, but looked like it was a bit 
> more involved to get it working.  And since I'll also need to run this 
> through PyInstaller, I was hoping to avoid it if possible since that might 
> open up another can of worms.
>
> I'll be sure to give the webview sample a shot and follow-up on wxWidgets 
> mailing list.
>
> On Friday, January 31, 2020 at 3:51:13 PM UTC-6, Scott Talbert wrote:
>>
>> On Fri, 31 Jan 2020, Dan Cutright wrote: 
>>
>> > I'm having trouble getting wx.html2 on MSW with IE backend to function 
>> > properly.  I've posted this issue on wxWidgets/Phoenix 
>> > (https://github.com/wxWidgets/Phoenix/issues/1319) back in August, but 
>> I've 
>> > yet to get a reply. 
>> > I'm using Bokeh to generate html files to be loaded into a wx.html2 
>> object. 
>> > Everything works fine on Mac and GTK, but MSW is missing some 
>> functionality 
>> > (e.g., cannot drag the plot, draw a box to zoom, or toggle figure 
>> legend 
>> > items).  There is a summary of some things I've tried in the linked 
>> GitHub 
>> > issue above, involving Windows registry or adding "mark of the 
>> internet"... 
>> > but no dice.  Below is a link to an example html file that works 
>> perfectly 
>> > fine when loading with IE directly. 
>> > 
>> > Has anyone else come across this issue?  Is there a work-around, or is 
>> this 
>> > just a bug? 
>> > 
>> > Does anyone know how to get a JS console readout from wx.html2?  Maybe 
>> > there's something about the bokeh generated html file that Bokeh could 
>> help 
>> > me with. 
>>
>> wxPython is (mostly) just a Python binding of the wxWidgets C++ library 
>> and wx.html2 is the Python binding for the wxWebView class of wxWidgets. 
>> As such, you may want to ask for help on the wxWidgets mailing lists as 
>> there may be more expertise there. 
>>
>> You could also try loading your page in the wxWidgets webview sample and 
>> see if it produces any errors there? 
>>
>> Additionally, I know there has been some recent work in wxWidgets on 
>> getting an Edge-based Webview backend supported.  I don't know the exact 
>> status of this, and it may take some time to get enabled in wxPython, but 
>> it may be a possibility down the road. 
>>
>> 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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/01980ee7-e5b1-43c5-ba6b-2e963ce24498%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.