HTTPDJS
HTTPDJS (HTTP Dynamic Javascript) is something I cooked up a while back when some of the available scripts out there had disappeared, or just were too buggy.
What does it do?
The problem with the XMLHttpRequest object, is that you cannot perform cross domain requests, something called the “same domain policy” comes into effect. This applies to other things such as iframes. I needed a way to perform requests from a remotely hosted forum (ProBoards in this case) that worked near enough like the XHR object. Before, I used to set a no content header in the PHP script, but there was no way to send data back without putting more work in, so I thought it was time for a script of my own.
So here it is, can’t remember when I created this. Might have been sometime last year. The zip file comes with an examples folder so you can see how it works (3 examples). The main things you need to do is include the HTTPDJS.js file, and the base64.js file (put above HTTPDJS.js). Next, you will need to edit the URL to the api.php file, this can be found in the HTTPDJS.js file.
GET and POST is supported.
Sending your own parameters is supported too.
Sending large amounts of data will be split up into parts and rebuild on the server.
Using it (example)
var params = “action=post&user=peter&msg=hello";
request.isReady = function(){
alert(request.responseText);
}
request.open("POST", “http://mydomain.com/post_message.php");
request.send(params);
The source
Any questions, post below.
No comments yet.
Leave a comment
What Am I Doing?
- Installed W@W 1.02 patch, should now be able to play with American friends, let the desync commence
- Just finished playing World at War, can now connect to people. Spawning is really bad, a very high chance of being shot in the back.
- Still can't connect to anyone on World at War multiplayer, but people can connect to me, very annoying.
- Finished Call of Duty World at War single player, felt shorter than Modern Warfare. Now I can play Zombie mode.
- Played Call of Duty World at War, at the moment I'm not keen on it, WWII doesn't do it for me. I'll keep playing, might start to like it.
- Yay, I got news that Call of Duty World at War has been delivered from Game.
- Just finished playing Call of Duty 4, which could be the last time, as W@W should arrive tomorrow.
- At work
- Played some CoD4 before work, my team was really bad
- Downloading Ubuntu, Vista is horrible to develope on
- On my way home through the lovely rain on my bike
- Completed Far Cry 2 at the weekend
- Installed Twinkle app on touch, awesome for a free app
- Setting up Twitter on my Ipod Touch
Search
Categories
- Browsers (14)
- Gaming (19)
- General (103)
- ProBoards (12)
- Programming (97)
- Adobe AIR (18)
- JavaScript (37)
- pDBB (8)
- PHP / MySQL (9)
- PHP-GTK (4)
- Videos (16)
- Work (4)
Recent Comments
Tags
2032 actionscript adobe africa alive air airpacker browser cod COD4 css dean edwards ds easing eric schmidt error explorer ext facebook file Firefox flickr Gaming google htaccess ie input internet JavaScript mime nintendo packer penner perl pleasurewood hills poignant PS3 robert ruby safari scrollovers testing theme park wii wordpress xboxArchives
- October 2008 (6)
- September 2008 (3)
- August 2008 (2)
- June 2008 (4)
- May 2008 (2)
- April 2008 (1)
- March 2008 (5)
- February 2008 (3)
- January 2008 (1)
- December 2007 (3)
- November 2007 (6)
- October 2007 (5)
- September 2007 (13)
- August 2007 (7)
- July 2007 (5)
- June 2007 (9)
- May 2007 (17)
- April 2007 (10)
- March 2007 (19)
- February 2007 (27)
- January 2007 (19)
- December 2006 (4)
- November 2006 (4)
- October 2006 (15)
- September 2006 (14)
- August 2006 (12)
- July 2006 (9)
- June 2006 (12)