1. What is the problem you are trying to solve?
I've been looking at Google's AJAX Libraries API recently and had an idea. Maybe I'm not even the first one to think about it. Why browsers do not have an ability to include Javascript libraries from their local source? If their size is large they don't need to be bundled with the browser itself but an ability to plug them in such a manner will decrease JS libraries load times and improve user's experience as a result.
2. What is the feature you are suggesting to help solve it?
New DOM(?) function loadLibrary():
Sample JS pseudo code:
- Code: Select all
if(window.loadLibrary && window.loadLibrary("jquery", "1.4")){
# Library is loaded. Nice.
}else{
# Browser don't have this library,
# requested version of it
# or it does not understand this at all.
# Load normally via script element from external source.
};
loadLibrary() should have an optional 3rd parameter for options too.
3. What is the processing model for that feature, including error handling?
It either loads and return true (all ok) or not and returns false (load manually as usual).
4. Why do you think browsers would implement this feature?
Currently JS support is somewhat inconsistent and lacking some now often used "web 2.0" UI features.
5. Why do you think authors would use this feature?
Mostly to improve user experience. This will reduce server load a bit too (no need to fetch a JS if it's already on user's side).
6. What evidence is there that this feature is desparately needed?
JS libraries tend to be quite large. + there are plugins for them like, say, jQuery UI (it should be possible to load it too in the same manner).