Access to DOMParser in Script

Is there a way to call window.open("https://getdrafts.com"); from a preview window on iOS and macOS?

It is inside a document.querySelector('svg').onclick = function (e) { ... } which might be the problem.

By the way I have added some alerts to debug and it seems that the macOS preview does chock on the first alert and not show any more alerts()…

Does the Preview window contain a browser window instance? Otherwise you don’t get DOM.

The preview window is a web browser. A WKWebView specifically, the same as used in Safari, so, yes, it has all the same scripting capabilities you would have in a browser, including DOM access.

Useful for DOM scripting, yes, and also for including and using Node-type libraries that can are compatible with browserify. I made an example “HTML > Markdown” action that uses Turndown in this way.

1 Like

that’s is good input.

thanks greg.

1 Like