Featured post
asp.net - Stop HTML/Javascript page from loading mid initialization -
so imagine piece of javascript first script on page along lines of
var mysuperobject = new (function () { this.superobjectinit(); })();
now imagine proceeds script (or large portion therein) requires superobject have met load conditions , loaded correctly.
assuming whatever reason loading of object fails need abort loading rest of page , scripts in particular.
i know majority of going scream why not have function issue callback onsuccess , onfailed problem in asp.net project masterpages, nestedmasterpages, usercontrols , forth (each of have own dependencies , scripts); rendering such approach problematic.
the other option (i assume) use window.location = "myerrorpage.html"; dont idea of having create page error message or fact causes redirect.
what hoping along lines of
stoploadingpage(); document.write("error has occurred");
but not sure how might accomplished.
what you're trying achieve isn't how web pages designed, far know not possible. logically, can stop in javascript started in javascript, workaround can think of load dependent scripts asynchronously.
i know isn't solution you're looking for, if there's no other alternative (and don't think there is), have @ requirejs, handles js dependencies (no need callbacks etc...): http://requirejs.org/
- Get link
- X
- Other Apps
Comments
Post a Comment