-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error handler for iframe contents #454
Comments
I think this issue might be indirectly related to #43. |
I understand it's necessary on UWP, even if it's a strange error handling design by Microsoft IMHO. |
OK, if it's only useful for UWP, maybe I should implement it only in Kiwix JS Windows? It's genuinely useful there, because otherwise I have to attempt to neutralize any JS on the page that can cause an exception (especially onclick type event handlers). I agree that it's strange error handling. They have global errorhandling for XAML / C++ etc., but none for HTML/JS UWP apps (maybe they expect developers to use native JS error handling). However, even in non-app usage, I seem to remember cases where an error on the page -- especially an error caused by If you don't think it's useful beyond UWP, I'll close this issue. |
Sorry for the delay : yes, I think it's currently not useful except for UWP, and agree it would be better to implement it only in Kiwix JS Windows. |
OK, thanks! Closing. |
Since the iframe can contain JavaScript that may run incompletely in jQuery mode, or even in SW mode where inline and certain other methods may be banned by Content Security Policies, it would seem like a good idea to add some global error handling for JavaScript in the iframe. In some app contexts (e.g. UWP), this can also prevent an app crash due to JS over which we have little control.
In Kiwix JS Windows, I have been experimenting with adding such a handler on first load of iframe contents. It looks like this:
Return true
prevents the system registering the error, and in UWP context, it prevents the app from crashing and closing. We can probably address the iframe without.frames[0]
-- that's just what has worked for me on first go.I think it might be useful to have this here, upstream, rather than just in Kiwix JS Windows. Note that this is not a global error catch for the JS in our app, just for any JS running in the iframe. It would be possible to add some global error catching as well, but only for production, obviously not for development. But I think that would be another issue.
The text was updated successfully, but these errors were encountered: