Eto Webview, Javascript & Leaflet.js

Hi all,

I’ve created a Eto.forms webview which I’d like to run a small piece of JavaScript - returning the coordinates of a selected location via Open Street Maps.

The JS file runs using Leaflet.js, and works perfectly in Edge. But in Rhino, it won’t load the map tiles, but will return coordinates when clicked on.

Is this because of Webview1, or not caching images, or something else?

Files attached - just need to remap .py lines 131 & 239 to the path where the html is saved.
Map.html (973 Bytes)
230728 Project Node Short.py (8.8 KB)
Ignore the formatting, thats the last job :wink:

Thanks!

Hi @Dan_Cornick,

Just curious, what does https://www.whatsmybrowser.org report?

Here is what I get:

image

import Eto
import Rhino
import System

class test_dialog(Eto.Forms.Dialog[bool]):
    def __init__(self, url):
        self.Title = "Test"
        self.Padding = Eto.Drawing.Padding(5)
        self.Size = Eto.Drawing.Size(640, 480)
        self.Resizable = True
        self.web_view = Eto.Forms.WebView()
        self.web_view.Url = System.Uri(url)
        self.Content = self.web_view

if( __name__ == "__main__" ):
    dialog = test_dialog('https://www.whatsmybrowser.org/')
    dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

– Dale

1 Like

Hi Dale,

Also reporting the same as you, Edge 18.

I’ve just tried it in Rhino 8, pasting into a fresh IronPython2 script and that reports a WebView2 error. So wondering if my Rhino 7 problem is driven by using WebView1?

Cheers
Dan

Update: - The self.m_webview.ExecuteScript('CoordsFinder' is creating the issue for Rhino 8 - delete that line and works perfectly.

Running your script in Rhino 8 reports Edge 115. So I do believe it’s a Webview2 which is causing the problem here!