I'm trying to capture the window.print() javascript call from a WKWebView with my app to actually show a print dialog and allow them to print from a button presented on the page (instead of a button inside my app). Does anyone know the best way to accomplish this?
Currently, for me, clicking a link that calls window.print() just does nothing but fire the decidePolicyForNavigationAction delegate method and I couldn't find anything relevant in there.
Figured it out just after posting (obviously)... Hopefully this helps someone else.
When creating your web view...
Then just adopt the WKScriptMessageHandler protocol in your view controller and add the required method...