We have several places where we include inline <script>blocks that run code wrapped in $(document).ready(). Some of these blocks use methods that depend on other external scripts. During normal page execution, this technology works fine, but when a user navigates from a page to its full load, an event occurs $(document).ready()and IE throws errors "Object does not support this property or method"on the left and right.
After some testing, I found that the event window.beforeunloadfires before any of the events ready, so I would like to be able to prevent events from triggering readyat this point. Ideally, I would like to have a solution that generalizes, so I do not need to modify all of the inline code.
If this is not possible, would you suggest wrapping all the embedded code in blocks try-catch, determining if all external scripts were loaded before executing the embedded code, etc.?
source
share