Posts

Showing posts with the label CDN

Once Again On Script Loaders

It's a long story I would like to summarize in few concrete points ... Three Ways To Include A Script In Your Page First of all, you may not need loaders at all. Most likely you may need an easy to go and cross platform build process, and JSBuilder is only one of them. The Most Common Practice This way lets users download and visualize content first but it lets developers start the JS logic ASAP as well without mandatory need to set DOMContentLoaded or onload event. <!doctype html> <head> <!-- head content here --> </head> <body> <!-- body content here --> <script src="app.minzipped.js">/* app here */</script> </body> </html> The "May Be Better" Practice I keep saying that a web application that does not work without JavaScript should never be accessed by a user. As example, if a form won't submit without JavaScript what's the point to show it befor...

How To JSONP A Static File

Update I have discussed this object a part and I agree that the url could be used as unique id as well. In this case the server should use the static url as unique id: StaticJSONP.notify("http://cdn.com/static/article/id.js",{..data..}); So that on client side we can use the simplified signature: StaticJSONP.request( "http://cdn.com/static/article/id.js", function (uid, data) { } ); The callback will receive the uid in any case so that we can create a single callback and handle behaviors accordingly. The script has been updated in order to accept 2 arguments but, if necessary, the explicit unique id is still supported. Under the list of " incomplete and never posted stuff " I found this article which has been eventually reviewed. I know it's " not that compact " but I really would like you to follow the reason I thought about a solution to a not so common, but quite nasty, problem. Back in 2001, my early attempts to include cal...