script.js
script.js copied to clipboard
File not found
Is there any way to know if file is not found (404)
Example
$script('someFileNotOnServer.js', function() { /* The code over here throws error. */ })
not at the moment. the callback will fire regardless of whether it returns 404 or 200
Once https://github.com/ded/script.js/pull/48 is merged you'll be able to have to declare a fallback function. Using it would look something like below.
$script('someFileNotOnServer.js', function() {
/* someFileNotOnServer.js' Found */
}, function(deps) {
/* someFileNotOnServer.js' Not Found */
})
:+1: This would be very useful to me.
Alright I'll try and sort this out soon
Any timeline on when this will be merged? I'm in desparate need of this type of logic and would like to stick to $script. Thanks
Cool stuff, error (404) and success (200) callbacks, can't wait for the PR merge
Hi, any news on when this functionality will be merged in?
cheers, florian
If you are only targeting IE9+ see: https://github.com/ded/script.js/issues/84
Hi! I using this flow with Angular, but it's not work like it suppose to be. I rewrited it using $script.ready(function(){},function(){}) but it goes throw second function, no matter file was found or not. I need to catch error when flow goes in the way that user have no ability to get files. How could I do it?