Detect If Gwt *.nocache.js File Loaded Properly
Solution 1:
Given that you cannot change things in your application, I will answer just to your question.
You need some javascript in your page.html
in order to check whether the gwt script has been loaded after a fixed time:
<head><script>setTimeout(function() {
if (!document.getElementById("my_module_name")) {
window.location.reload();
}
}, 4000)
</script><scriptlanguage="javascript"src="my_module_name.nocache.js"></script></head>
In the case you use an iframe based linker (standard, xsiframe), the .nocache.js
creates an iframe to load the appropriate permutation, and gives it the name of the module, so checking for the presence of that element after a while is enough to know whether the app was loaded.
You could also check for the presence of especial properties which gwt sets to the window like window.__gwt_activeModules
Solution 2:
Typically, a GWT app loads first, then you do authentication. You can use a split point, if you want, to load only the login page. Then, after the authentication is confirmed, you load the other parts of your app.
I have never seen a scenario where authentication is done before a page loads. Maybe you can explain why you did it this way.
As for your question, you need a JavaScript to detect if another JavaScript was successfully loaded, but this solution adds an unnecessary level of complexity.
Post a Comment for "Detect If Gwt *.nocache.js File Loaded Properly"