[Feature]: Passing data to html page via html.dialog5 etc.
Feature Request
Currently there is no clean way of passing data from a macro to a html page displayed via html.dialog5 and its ilk. The only way is more or less hacky methods of storing data somewhere, e.g. in a MT variable, and then read it back, once the html page is up.
This is somewhat problematic and prone to errors.
The html.dialog5 is otherwise great, as it fosters a certain level of laying in the code.
The Solution you'd like
I see a couple of possible solutions.
- Allow query parameters in the url and implement something like
Document.documentURIorwindow.locationwhich exists in the DOM normally. This way, the signature of ´html.dialog5` will be unchanged. - Alternatively the signature of
html.dialog5should be expanded with another parameter. This is used to pass any data in the form of a json object. Then a way of reading that object from embedded javascript is needed.
Alternatives that you've considered.
No response
Additional Context
No response
Worth noting html.dialog5 already has a userdata parameter which stores arbitrary user data tagged to the dialog (or frame) itself. The problem is this cannot be fetched by the html5 context because it must be fetched by name, and the html5 context is unaware of its own name.
It would be sufficient to set the window.name property within the html5 context to the name of the frame (probably in the form of {kind}:{name}, so dialog5:example or similar. window.name is included, but optional, in the window spec for javascript in html5.