FB and G+, the new OS-wars
Back when Linux was a gangly youth, there was a great excitement every time you did an update. Unlike Windows and Mac with their expensive three-year-nothing-then-a-service-pack-with-cool-stuff routines, in Linux, there were so many cool free packages around, and /every one/ of them would have something new almost every week.
So, I spent quite a lot of time compiling and recompiling, everything from wget up to the KDE behemoth. And I’d be reading the weekly release notes as well to see if there was any new trick out that week.
I can’t tell you how excited I was when I first installed a copy of Linux where I didn’t have to configure X11 using a text-mode Xconfigureateur!
Or when I recompiled my kernel the first time, or when I recovered from a bad update straight from the GRUB command-line. Or the first time I ejected a CD from across the room (logged in remotely), or freaking out the wife by playing some music on her laptop from a different room.
In the last few years, Linux development has matured, though, so there’s not the same edge-of-the-seat excitement that there used to be, but I think there’s still hope for the techadrenaline junkies out there, because Facebook and Google+ are the new cool, and there’s a /ton/ of stuff that can be done with that!
My eyes are on how FB and G+ evolve. now that FB has competition, I expect some /really/ cool stuff is going to come out of the woodwork.
Sorry to post here, I saw no other way to contact you.
The link to the “nonActiveX-XMLHTTPRequest.js” is broken in this article
http://verens.com/2005/08/12/ajax-in-ie-without-activex/
I would like to have a look at the source. Could you please fix the link?!
Thanks.
Hi Bernhard – wow, that’s a blast from the past…
I actually had to dig out some old website backups to find that file. I’ve recovered it to here: http://demo.verens.com/nonActiveX-XMLHTTPRequest.js
It should be fairly simple to make it work with POST. it currently is GET-only, if I remember right.
The code hasn’t been touched in 7 years, so ignore the ickiness π
Thank you. Its just for fun. Even our stubborn client is probably going to abandon IE6 this year. *yeah* π
All right, here is my edited Version (to work as a drop-in-replacement for my Ajax-Library):
function XMLHttpRequest_iframe(){
var that;
that = this;
this.onreadystatechange=function(){return false;}; // dummy, no function yet
this.setRequestHeader = function(){return false;}; // dummy, no function yet
this.getResponseHeader = function(){return false;}; // dummy, no function yet
this.abort = function(){this.readyState = 0;}; // abort running operation, not reliable
this.open=function(method, url, async){
this.abort(); // try to avoid concurrent operations
this.readyState = 2;
this.async = async;
this.url = url;
this.method = method.toLowerCase();
};
this.send = function(postdata){
var wait4result;
// iframe is loaded, return response
function isLoaded(){
var body;
if (that.readyState > 0) { // do nothing if operation is aborted
body = this.contentWindow.document.documentElement || this.contentWindow.document.body;
that.responseText = body.innerText || body.textContent;
that.readyState = 4;
that.status = 200;
that.onreadystatechange();
}
this.remove(); // remove iframe object after operation
}
if(this.method === 'post') {this.url = this.url + '?' + postdata;} // awkwardly convert POST to GET - parameters
Elem.create('iframe', {'src':this.url, 'style':{'display':'none'}}, {'load':isLoaded}).addToBody(); // create iframe, set onload-event
this.readyState = 3;
// horrible synchronous mode implementation for compatibility reasons, user interaction required to stop thread and have iframe loaded
if (!this.async) {
wait4result = true;
while (wait4result && this.readyState > 0 && this.readyState < 4){wait4result = confirm('One moment please.\nPress "OK" to proceed');}
return this.responseText;
}
};
}
I added simple POST-compatibility and some streamlining (and cross browser compatibility, testet in IE6/8 and FF).
80% of the time i was trying to implement some synchronous-mode hack, but it isn’t really possible to do it in a nice fashion.
In one place, it relies on a little Helper I wrote, so the
Elem.create(… line has to be rewritten, it just creates the iframe, adds an onload-event handler and adds it to the document, nothing special
PS: Will post this in the original thread, too, if someone is interested.
Hmm, the original post is locked.
Sorry for the messed up display, the -tags do not work quite as expected… π