Shouldn't WApplication::require() return false when url is not found?
Added by Artur Adib about 15 years ago
Perhaps I'm missing something, but if I do
WApp->require("whatever.js");
and the file is not found (i.e. http GET returns 404), the function doesn't return false.
Shouldn't that be the desired behavior?
Thanks!
Replies (1)
RE: Shouldn't WApplication::require() return false when url is not found? - Added by Koen Deforche about 15 years ago
Hey,
A missing JavaScript file is indeed not handled well (or even at all) by the library: the interface will simply block.
We cannot change the require() API however: this is a server-side API, and there is no reliable way to check whether a URL will return a valid file server-side (for various reasons).
But we could make it so that a missing JavaScript file is handled more gracefully, by having for example a signal in WApplication which is emitted and can be used to handle this (notify the user, etc...). Would that work for you ?
Regards,
koen