javascript - Is there a way to prevent a 3rd party JS code located in the <head> from taking down a site if not available? -
i'm building feature require web publishers put js code snippet in section of page in order work. code includes call external (and dynamically generated) js file remote server. file cannot cached putting on cdn isn't option.
what i'm worried if there ever problem remote server make remote file unreachable, can take down page in code included (potentially entire site code suppose included site-wide).
is there way make sure no matter what, availability of remote file never affect availability of page in code included?
-edit- resources in remote file need available before html of page starts render. loading code asynchronously isn't option.
you specify async=true
not "block" page resuming loading other resources. otherwise it'll halt @ script, though may vary depending on how each browser handles stalling script elements.
note: support of async attribute varies - modern browsers circa 2014 understand if need support legacy browsers may need alternative solution ( can see @ link referenced ).
more details @ https://css-tricks.com/thinking-async/
Comments
Post a Comment