.:] xmlhttprequest.and.you [:.
So this week I had an enhancement at work which required me to write some new Ajax functionality for the website. The enhancement was rather trivial really, essentially I needed to drop something on the session real-time so that I could get at it later.
So I wrote myself a quick `n` dirty little servlet to handle the back end, and a JavaScript function which acted as a client-side version of HttpSession.setAttribute().
Pretty straight-forward all the way around. So I get to testing, the functionality basically allows the user to set the font-size for article content on the site, the Ajax end of things just made sure that whatever size the user selected persisted throughout their session so that every article they read would be in that font size.
So it comes time to test it, of course, I test it in Firefox first, and it works flawlessly, then I decide I had better test it in IE and that is where the trouble starts. It seems like it works the first couple of times I select the font size but then all the sudden it won`t change anymore… What the heck is going on here???
I attach my debugger to my servlet, drop in a breakpoint, and sure enough, the first few times I select a font size, I drop into the servlet, however, after a few times, I am not getting into the servlet anymore, hence, my selection is not persisting.
So where is the problem? Yep, you guessed it!
It turns out that IE is caching XMLHttpRequest Objects keyed off the request url. What, wait a minute! Doesn`t that completely go against everything that Ajax is supposed to do?!? Yes, yes it does, but the genius`s over at Microsoft decided that maybe it would be good to add this little feature, I mean, after all, it`s not like responses ever change right? Especially in cases where I am polling for something to happen before I do something on the front end…
Anyhow, enough of my little anti-microsoft rant. So bottom line, the work-around is easy, and since it drove me insane today, I thought I would share it here with my loyal and future loyal readers..
var requestUrl = "http://myserver.com/action?param=1&token=" + getToken();var getToken: function() {
return Math.round( Math.random() * 65535 );
}
Voila, now every time you make a request, the url is slightly different… Simple, effective fix. There are, of course, a million and one ways to make the url unique each time, however, for most intents and purposes this will work fine.
Hope this saves someone the couple of hours I spent debugging today… Enjoy!

████████►BUY CIALIS◀████████…
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲…
Trackback made by CARLOS on 18.12.2010 @ 06:31:13
████████►BUY CIALIS◀████████…
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲…
Trackback made by CHARLIE on 18.12.2010 @ 13:10:39
order cialis in canada online…
Buyno prescription…
Trackback made by ANDREW on 23.12.2010 @ 16:38:51
Cialis discount…
Buyno prescription…
Trackback made by DERRICK on 24.12.2010 @ 00:33:44
Abilify…
Buygeneric pills…
Trackback made by KARL on 24.12.2010 @ 14:02:23
Abilify@official.site” rel=”nofollow”>……
Buyno prescription…
Trackback made by WALTER on 27.12.2010 @ 04:19:09
fosamax@actonel.now” rel=”nofollow”>.…
Buynow…
Trackback made by RICARDO on 28.12.2010 @ 01:12:45
Allegra@official.site” rel=”nofollow”>……
Buygeneric pills…
Trackback made by CLAUDE on 29.12.2010 @ 16:46:22
Avelox@official.site” rel=”nofollow”>……
Buyno prescription…
Trackback made by CHRISTIAN on 30.12.2010 @ 12:39:06
avodart@in.usa” rel=”nofollow”>.…
Buyno prescription…
Trackback made by GUY on 30.12.2010 @ 15:47:12
generic@Cialis.now” rel=”nofollow”>.…
Buynow…
Trackback made by ENRIQUE on 04.01.2011 @ 13:47:43
……
Buynow it…
Trackback made by BRETT on 07.01.2011 @ 19:17:19
dicyclomine@and.imodium” rel=”nofollow”>……
Buygeneric drugs…
Trackback made by SERGIO on 08.01.2011 @ 11:43:46
cephalexin@use.now” rel=”nofollow”>……
Buygeneric drugs…
Trackback made by LEE on 10.01.2011 @ 00:33:07
purchase@effexor.now” rel=”nofollow”>.…
Buyno prescription…
Trackback made by ERNEST on 11.01.2011 @ 23:55:56
Depakote@official.site” rel=”nofollow”>..…
Buygeneric meds…
Trackback made by COREY on 21.01.2011 @ 03:09:17
depakote@400mg.now” rel=”nofollow”>.…
Buywithout prescription…
Trackback made by JULIAN on 21.01.2011 @ 03:11:38
Depakote@official.site” rel=”nofollow”>.…
Buygeneric drugs…
Trackback made by DENNIS on 21.01.2011 @ 06:20:18
depakote@classification.now” rel=”nofollow”>..…
Buygeneric drugs…
Trackback made by CURTIS on 21.01.2011 @ 14:17:17
Buy@Discount.Abilify” rel=”nofollow”>……
Buywithout prescription…
Trackback made by ROY on 29.07.2011 @ 11:17:24
Order@Abilify.Online” rel=”nofollow”>.…
Buynow it…
Trackback made by EDUARDO on 29.07.2011 @ 11:42:03
Purchase@Discount.Abilify” rel=”nofollow”>..…
Buyit now…
Trackback made by TERRENCE on 29.07.2011 @ 13:43:09
Order@Discount.Acai” rel=”nofollow”>……
Buywithout prescription…
Trackback made by TRACY on 30.07.2011 @ 10:26:42
Purchase@Generic.Acai” rel=”nofollow”>……
Buygeneric drugs…
Trackback made by WALLACE on 31.07.2011 @ 03:56:22
Cheap@Acai.Without.Prescription” rel=”nofollow”>..…
Buygeneric meds…
Trackback made by SALVADOR on 31.07.2011 @ 08:10:44
Cheap@Acai.500mg” rel=”nofollow”>..…
Buygeneric drugs…
Trackback made by DUSTIN on 31.07.2011 @ 08:34:23
Buy@Cheap.Abana” rel=”nofollow”>..…
Buyno prescription…
Trackback made by BRANDON on 01.08.2011 @ 03:38:23
Buy@Discount.Coral.Calcium” rel=”nofollow”>.…
Buygeneric meds…
Trackback made by FRANKLIN on 02.08.2011 @ 00:27:12
Buy@Discount.Abilify” rel=”nofollow”>..…
Buygeneric pills…
Trackback made by EDUARDO on 02.08.2011 @ 21:53:23
Buy@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>……
Buywithout prescription…
Trackback made by PERRY on 03.08.2011 @ 08:17:22
Buy@Discount.Acai” rel=”nofollow”>……
Buynow…
Trackback made by KIRK on 03.08.2011 @ 16:01:19
Order@Acai.Online” rel=”nofollow”>..…
Buydrugs without prescription…
Trackback made by RICARDO on 03.08.2011 @ 17:12:06
Purchase@Aciphex.Online” rel=”nofollow”>.…
Buygeneric drugs…
Trackback made by BILLY on 07.08.2011 @ 09:18:22
Buy@Aciphex.20mg” rel=”nofollow”>.…
Buygeneric drugs…
Trackback made by RICARDO on 08.08.2011 @ 12:47:54
Cheap@Generic.Aciphex.20mg” rel=”nofollow”>.…
Buygeneric drugs…
Trackback made by BRUCE on 08.08.2011 @ 15:54:30
Purchase@Actos.Online” rel=”nofollow”>..…
Buygeneric meds qmo…
Trackback made by CLIFTON on 11.08.2011 @ 05:50:55
Purchase@Generic.Acai” rel=”nofollow”>..…
Buydrugs without prescription faj…
Trackback made by MITCHELL on 14.08.2011 @ 17:02:24
Cheap@Accutane.Without.Prescription” rel=”nofollow”>……
Buydrugs without prescription jlg…
Trackback made by BRETT on 17.08.2011 @ 14:34:40
Get@Aciphex.Online” rel=”nofollow”>.…
Buygeneric drugs nih…
Trackback made by BRYAN on 18.08.2011 @ 11:19:28
Purchase@Generic.Aciphex” rel=”nofollow”>..…
Buydrugs without prescription ygy…
Trackback made by EVAN on 18.08.2011 @ 19:14:07
Order@Actonel.Online” rel=”nofollow”>……
Buynow fjl…
Trackback made by LOUIS on 21.08.2011 @ 11:24:25
Buy@Cheap.Advair” rel=”nofollow”>.…
Buygeneric drugs axm…
Trackback made by ZACHARY on 22.08.2011 @ 08:46:10
Buy@Discount.Aggrenox” rel=”nofollow”>..…
Buyno prescription wkp…
Trackback made by JOEL on 24.08.2011 @ 17:39:06
Order@Discount.Aggrenox” rel=”nofollow”>..…
Buyno prescription lka…
Trackback made by NICK on 24.08.2011 @ 21:42:57
Purchase@Cheap.Aggrenox” rel=”nofollow”>……
Buywithout prescription ccw…
Trackback made by JASON on 25.08.2011 @ 00:23:23
coral@calcium.vitamin.explanation” rel=”nofollow”>.…
Buywithout prescription…
Trackback made by ENRIQUE on 26.08.2011 @ 04:06:34
aleve@cold.tablets” rel=”nofollow”>……
Buygeneric pills…
Trackback made by JOSE on 27.08.2011 @ 05:20:58
coral@calcium.supplements” rel=”nofollow”>……
Buygeneric meds…
Trackback made by RUBEN on 27.08.2011 @ 22:06:36
stage 3 ovarian cancer…
Buy_drugs without prescription…
Trackback made by TYLER on 17.10.2011 @ 14:30:12
the process of methanogens metabolism…
Buy_drugs without prescription…
Trackback made by FREDDIE on 18.10.2011 @ 18:24:56
ept pregnancy test…
Buy_generic meds…
Trackback made by PEDRO on 22.10.2011 @ 00:59:39
market drugs edmonton…
Buy_now it…
Trackback made by DERRICK on 23.10.2011 @ 07:32:12
adrenal cancer symptoms…
Buy_generic drugs…
Trackback made by LESLIE on 24.10.2011 @ 17:59:13
indigestion and chest pain…
Buy_now it…
Trackback made by GORDON on 25.10.2011 @ 22:18:39
ultimate diet pills…
Buy_generic pills…
Trackback made by ISAAC on 26.10.2011 @ 08:18:38
decongestants hypertension safe…
Buy_now it…
Trackback made by KYLE on 29.10.2011 @ 18:50:44
canine kidney failure symptoms…
Buy_generic pills…
Trackback made by JORDAN on 30.10.2011 @ 23:55:45
insulin receptor inhibition…
Buy_without prescription…
Trackback made by BRADLEY on 01.11.2011 @ 12:37:35
sample tlc diets…
Buy_generic drugs…
Trackback made by RICARDO on 04.11.2011 @ 01:29:29
cancer chemotherapy combination drugs…
Buy_generic meds…
Trackback made by JORGE on 05.11.2011 @ 08:25:38
rebound phenomenon during gradual clonidine withdrawal…
Buy_drugs without prescription…
Trackback made by THEODORE on 06.11.2011 @ 06:06:01
kids weight gain…
Buy_generic drugs…
Trackback made by BRADLEY on 06.11.2011 @ 12:45:49
100 mile diet store…
Buy_generic meds…
Trackback made by MICHAEL on 07.11.2011 @ 20:25:20
list of anti anxiety drugs…
Buy_generic meds…
Trackback made by NATHANIEL on 08.11.2011 @ 05:14:30
pain relief until root canal…
Buy_generic meds…
Trackback made by JIMMY on 08.11.2011 @ 12:19:36
glucose to insulin ratio metabolic syndrome…
Buy_drugs without prescription…
Trackback made by ZACHARY on 08.11.2011 @ 18:58:04
interactions with azithromycin and astragalus…
Buy_it now…
Trackback made by LUKE on 10.11.2011 @ 15:57:07
dog retching vomiting weight loss…
Buy_generic drugs…
Trackback made by STEVE on 11.11.2011 @ 23:38:54
does hiv always lead to aids…
Buy_generic meds…
Trackback made by DEREK on 12.11.2011 @ 04:38:23
space herpes…
Buy_now…
Trackback made by ARTURO on 13.11.2011 @ 02:18:39
remeron dreams…
Buy_it now…
Trackback made by DOUG on 16.11.2011 @ 10:34:56
fruity taste and diabetes…
Buy_it now…
Trackback made by JIM on 16.11.2011 @ 23:56:06
side@effects.of.protonix.after.it.has.been.stopped” rel=”nofollow”>……
Buynow it…
Trackback made by JORDAN on 09.12.2011 @ 06:39:19