Yesterday, I found that people are actually using my ages old XMLHttpRequest script. At least, that's how some people end up on this blog - after googling for "Jasper's HttpRequest script".
Well, it's quite old and uses techniques for compatibility with older browser which basically have been given up on today (IE 6). Still, I think the thing should still work. But it wasn't hosted anywhere, so now is my chance to fix that. Here's an all-new link to the script: link.
I do want to revisit the script some time and update it and all and perhaps it will even some day be integrated into GoodLooking. Until that time, feel free to use the script from the link above. There is one thing I do ask you for, though. I would like it if you let me know what you are using the script for. Just out of curiosity, really.
Showing posts with label request. Show all posts
Showing posts with label request. Show all posts
Friday, November 18, 2011
Saturday, December 15, 2007
XmlHttpRequest script 2.0
Quite a while ago, I told you about this script that I had written, which would make xmlHttpRequests for me. Now I have made a version 2.0, I ramp up all the way to the next major version umber. Why? Because there are considerable changes, including ones in syntax.
I changed the name of my function, added an argument (called args for irony's sake). Besides that the script now supports POST calls besides the regular GET calls. Also, it no longer ought to make any kind of complain when new requests are made before the first one is finished.
The script is available from here, but there are some things I really want to say. For my bandwidth (even though it won't matter much) and your security, do not include the script right from my website. Instead, download it, and put it with your website on a host and then include it using a script tag. And to make sure I won't mistake you for a "includer" do not link directly to the file, link to this post instead.
If you stick to these few rules you can use my script. A guide is to be found within the file (all commented out of course) - using the script shouldn't be too hard. Good luck with your web designing.
Changelog
I changed the name of my function, added an argument (called args for irony's sake). Besides that the script now supports POST calls besides the regular GET calls. Also, it no longer ought to make any kind of complain when new requests are made before the first one is finished.
The script is available from here, but there are some things I really want to say. For my bandwidth (even though it won't matter much) and your security, do not include the script right from my website. Instead, download it, and put it with your website on a host and then include it using a script tag. And to make sure I won't mistake you for a "includer" do not link directly to the file, link to this post instead.
If you stick to these few rules you can use my script. A guide is to be found within the file (all commented out of course) - using the script shouldn't be too hard. Good luck with your web designing.
Changelog
- changed the name of main function from send to request
- added an argument to request in preparation for POST support
- changed GET cases to work with new args argument
- added POST support
- made XMLHttpRequest variable local - solving problems with multiple calls after eachother
- renamed the XMLHttpRequest variable from submitting to XHRequest
- removed time-out as changes should have taken away any reason for it
- deleted highPrioritySend function, as it would do nothing now
- removed global variables busy and time_out that were related to time outs
- made receive an inline, unnamed function inside request - allowing easier variable names
- removed global variable next_function, as this allowed todo to be used directly (woot, no global variables anymore)
Saturday, July 7, 2007
My two scripts
So, I did not post anything anything for quite a while.
Just to let you all know I fixed the script - it turned out that IE 7 actually uses xmlHttpRequest object, like all other browsers do and I had a variable set inside the xmlHttpRequest object-specific bit, while it should have been in the general bit. Moreover this was a function variable, which made it hard to discover the mistake.
The finished script, which is just a general script to make using the xmlHttpRequest, can be found here. Instructions are found inside the document, this does dramatically increase the size of the document, but if necessary you can cut it out - just the instructions not the notices and such, under the header NOTICE you will find directions what you can and what you can not cut out.
If the need arises to update the script, (there might still be a firefox-bug and there is no support for SEND requests yet) I will update the script at that location and post here that I made the changes. Though it might seem convenient to have your script tag point to it directly, PLEASE DO NOT DO THIS. Download the file and upload it again on your website, this leaves me without bandwidth stains and leaves you with less vulnerabilities (to attacks of mine, hehe).
I made yet another script - a batch script this time. It's a really, really simple script - so if you want to be sure it is nothing malicious, open it with wordpad. If you know something about DOS-commands you will see that it's really innocent (okey, it forces a delete, but that's the whole point of the script).
Okey, I lied, you do not need the file unless you are playing on a private server, private servers change and so your cache might be in the way (if your server crew has never said anything about emptying your cache, this file might not be for you).
Put this file in your WoW folder and run it instead of WoW.exe (or Launcher.exe). This makes sure that your cache is emptied before you start WoW, every time you start WoW. (Of course you might want to change your shortcut to this file and give it back it's icon by clicking on change icon and selecting WoW.exe there).
I hope either of these two scripts can help you, and if not, too bad :P
PS. if you want to link to one (or both) of these files, please link to this post, so I do not falsely identify you as a leecher.
Just to let you all know I fixed the script - it turned out that IE 7 actually uses xmlHttpRequest object, like all other browsers do and I had a variable set inside the xmlHttpRequest object-specific bit, while it should have been in the general bit. Moreover this was a function variable, which made it hard to discover the mistake.
The finished script, which is just a general script to make using the xmlHttpRequest, can be found here. Instructions are found inside the document, this does dramatically increase the size of the document, but if necessary you can cut it out - just the instructions not the notices and such, under the header NOTICE you will find directions what you can and what you can not cut out.
If the need arises to update the script, (there might still be a firefox-bug and there is no support for SEND requests yet) I will update the script at that location and post here that I made the changes. Though it might seem convenient to have your script tag point to it directly, PLEASE DO NOT DO THIS. Download the file and upload it again on your website, this leaves me without bandwidth stains and leaves you with less vulnerabilities (to attacks of mine, hehe).
I made yet another script - a batch script this time. It's a really, really simple script - so if you want to be sure it is nothing malicious, open it with wordpad. If you know something about DOS-commands you will see that it's really innocent (okey, it forces a delete, but that's the whole point of the script).
Okey, I lied, you do not need the file unless you are playing on a private server, private servers change and so your cache might be in the way (if your server crew has never said anything about emptying your cache, this file might not be for you).
Put this file in your WoW folder and run it instead of WoW.exe (or Launcher.exe). This makes sure that your cache is emptied before you start WoW, every time you start WoW. (Of course you might want to change your shortcut to this file and give it back it's icon by clicking on change icon and selecting WoW.exe there).
I hope either of these two scripts can help you, and if not, too bad :P
PS. if you want to link to one (or both) of these files, please link to this post, so I do not falsely identify you as a leecher.
Saturday, June 16, 2007
From an online game to a virtual machine
So I decided to get my gears back into a project that had been abandoned for almost a year now. An online game that I started as a school project, but I didn't really finish it at the time. I had been thinking of taking it up again a long time, but did not do so until now.
The first thing I was going to do was rewrite the protocol, I needed to make it more foolproof. For making it I had simply made a chat, just to design the way the client communicates with the server. I pulled this chat out of the closet and started working on it again.
I wanted smooth transitions back in the day, so I opted for using the xmlHttpRequest method. Big mistake. It's a nice method and gives nice results (and I love knowing quite a bit about it now), but it has been taking up quite a bit of time. Okey, maybe it was not such a big mistake, but it was probably not the right choice for a school project you are supposed to spend 10 hours on (I was intending to spend more on it anyway - when hobbies and school meet there is something to be gained :P).
Anyway, I was refining my protocols, so I was dabbling with the xmHttpRequest again. Cross-browser compatibility is the worst thing with it. But in the process I found out that IE 7 actually uses the syntax every other browser uses, unlike other versions of internet explorer. One big step forward, as my new code (this time I made better use of functions and put some 'libraries' in external files and made the code so that if any file does not reach it's destination the worst thing that can happen is text that is typed not appearing on the screen) worked with IE 7 immediately after designing it for Firefox. I had left in a bit that was different for IE, but as it turned out that was only needed for IE 6 and below. Unfortunately many people still use IE 6 and thus I want my site to be IE 6-compatible. So I went and started to adjust it. My first problem was a simple mislocation of a statement (inside the non-IE bit rather than just done no matter the browser). But I wasn't out of problems yet, there was some other problem as well, which I haven't fixed yet. I needed IE 6 to see what the problem was, but I only ran IE 7, and you can not have both at the same time.
I tried MultipleIEs an application that does let you run multiples, but I wasn't able to clear the cache there and you can not ctrl-f5 a js-file (yes in FF you can, but not in IE). The big plus was that I had already installed some IE-javascript debugger (some other m$ product that dual-functioned? The debugger I tried to install last year when working on this project?). Anyway I decided to go for the one other option, making a virtual pc and running IE 6 on that (there are special images for this).
So I looked up Microsoft Virtual PC (I knew how to use it, I had dabbled with a earlier trial version before) and you know what, it was F-R-E-E. Wow, that's the second (or even third) positive thing about Microsoft in this post.
To be honest I already knew it was free, as it was told on each of the pages that told me about this workaround for running more than one version of IE... but that's where I am now, downloaded the stuff and and installed it. Now I have to get the IE dev toolbar (a friend told me about this when trying to help me with this project) to my virtual pc as well as the mysterious debugger. Let's hope it works out.
The first thing I was going to do was rewrite the protocol, I needed to make it more foolproof. For making it I had simply made a chat, just to design the way the client communicates with the server. I pulled this chat out of the closet and started working on it again.
I wanted smooth transitions back in the day, so I opted for using the xmlHttpRequest method. Big mistake. It's a nice method and gives nice results (and I love knowing quite a bit about it now), but it has been taking up quite a bit of time. Okey, maybe it was not such a big mistake, but it was probably not the right choice for a school project you are supposed to spend 10 hours on (I was intending to spend more on it anyway - when hobbies and school meet there is something to be gained :P).
Anyway, I was refining my protocols, so I was dabbling with the xmHttpRequest again. Cross-browser compatibility is the worst thing with it. But in the process I found out that IE 7 actually uses the syntax every other browser uses, unlike other versions of internet explorer. One big step forward, as my new code (this time I made better use of functions and put some 'libraries' in external files and made the code so that if any file does not reach it's destination the worst thing that can happen is text that is typed not appearing on the screen) worked with IE 7 immediately after designing it for Firefox. I had left in a bit that was different for IE, but as it turned out that was only needed for IE 6 and below. Unfortunately many people still use IE 6 and thus I want my site to be IE 6-compatible. So I went and started to adjust it. My first problem was a simple mislocation of a statement (inside the non-IE bit rather than just done no matter the browser). But I wasn't out of problems yet, there was some other problem as well, which I haven't fixed yet. I needed IE 6 to see what the problem was, but I only ran IE 7, and you can not have both at the same time.
I tried MultipleIEs an application that does let you run multiples, but I wasn't able to clear the cache there and you can not ctrl-f5 a js-file (yes in FF you can, but not in IE). The big plus was that I had already installed some IE-javascript debugger (some other m$ product that dual-functioned? The debugger I tried to install last year when working on this project?). Anyway I decided to go for the one other option, making a virtual pc and running IE 6 on that (there are special images for this).
So I looked up Microsoft Virtual PC (I knew how to use it, I had dabbled with a earlier trial version before) and you know what, it was F-R-E-E. Wow, that's the second (or even third) positive thing about Microsoft in this post.
To be honest I already knew it was free, as it was told on each of the pages that told me about this workaround for running more than one version of IE... but that's where I am now, downloaded the stuff and and installed it. Now I have to get the IE dev toolbar (a friend told me about this when trying to help me with this project) to my virtual pc as well as the mysterious debugger. Let's hope it works out.
Subscribe to:
Posts (Atom)