Topic: When did you start with Ajax? Pages that link to <a href="https://ozoneasylum.com/backlink?for=28757" title="Pages that link to Topic: When did you start with Ajax?" rel="nofollow" >Topic: When did you start with Ajax?\

 
Author Thread
liorean
Bipolar (III) Inmate

From: Umeå, Sweden
Insane since: Sep 2004

IP logged posted posted 12-21-2006 14:07 Edit Quote

Just found this snippet stored away on one of my harddrives. Dated March 2003:

code:
/***********************\
 * Dynamic File Reader *
 * by: Liorean         *
\***********************/

function File(){
  var r;
  switch(0+(1*(typeof document.getElementById!='undefined')+2*(typeof clientInformation!='undefined')+4*(typeof netscape!='undefined'))*(typeof opera=='undefined')){
    case 3:
      r=new ActiveXObject('Microsoft.XMLHTTP');
      break;
    case 4:
      r=new NN4HttpRequest;
      break;
    case 5:
      r=new XMLHttpRequest;
      break;
    default:
      r={
        open:function(){},
        send:function(){return false},
        responseText:''
      };
      break
  }
  this.prototype=r;
  return r;
}

function NN4HttpRequest(){
  this.url=this.responseText=''
}
NN4HttpRequest.prototype.open=function(m,u){
  this.method=m||'GET';
  this.url=u
}
NN4HttpRequest.prototype.send=function(){
  if(this.url=='')return false;
  if(!/^[a-z]+:/.test(this.url))
    this.url=String(window.location).replace(/\/[^\/]*$/,'/'+this.url);
  var l,
    b;
  this.responseText='';
  b=new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(this.url).openStream()));
  while((l=b.readLine())!=null)
    this.responseText+=l+'\n';
    if(b!=null)
      b.close();
  return true
}

Seems you can teach old dogs new tricks after all

--
var Liorean = {
abode: "http://liorean.web-graphics.com/",
profile: "http://codingforums.com/member.php?u=5798"};

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

IP logged posted posted 12-21-2006 17:04 Edit Quote

One of the first thing I made when I learnt PHP in 2000-2001 was some sort of chat client. It didn't use XHR but the good old 1px IFRAME technique with an open connection.

liorean
Bipolar (III) Inmate

From: Umeå, Sweden
Insane since: Sep 2004

IP logged posted posted 12-21-2006 21:04 Edit Quote

Well, I did some form of JavaScript Remote Scripting Back in nn4/ie4, but you had to jump through hoops and climb over cesspits to get it working there... and half the time the browser crashed if your file timed out...

Never really liked the iframe/layer method though.

--
var Liorean = {
abode: "http://web-graphics.com/",
profile: "http://codingforums.com/member.php?u=5798"};

H][RO
Paranoid (IV) Inmate

From: Australia
Insane since: Oct 2002

IP logged posted posted 01-03-2007 02:50 Edit Quote

2006



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu