RSS

[ajax][IE][tip] ajax functions show random behaviour in IE and works fine in all other browsers

24 Dec

IE needs special care while designing css and scripting js/ajax. Once while using sortable function and updating db as per latest sorting i get random behavior of IE as compare to other browsers (Firefox, Chrome etc). On first move the html element got sorted but is not updated in db; and for all moves-other than the first one-it works fine.
After debugging the issue for hours i was just like…

Stucked

Stucked

Then i ‘Delete Browser History’ and thus it works perfectly fine for all moves even for FIRST ONE. Following are the screenshots illustrating the ‘Delete Browser History’ process

Delete Browser History

Delete Browser History

Delete

Delete

Thanks to ‘Delete Browser History’ option 🙂

Later on, I found How to solve Internet Explorer cache issue in Ajax .

When you call the method:

http.open

add a random variable using Math object and add it in the method’s URL argument, for example:

nocache = Math.random();
http.open('get','page.php?url_parameter='+
parameter+'&nocache ='+nocache);
In this way all the new request will have an URL parameter (&nocache) which force the browser to “refresh” the old value with the new value.
Advertisements
 
4 Comments

Posted by on December 24, 2011 in ajax

 

Tags: , , , , , , , , , ,

4 responses to “[ajax][IE][tip] ajax functions show random behaviour in IE and works fine in all other browsers

  1. Nicolas

    March 18, 2013 at 3:35 pm

    I wish to express some thanks to you for bailing me out of this type of trouble.
    After checking throughout the online world and meeting notions which were not helpful,
    I thought my entire life was done. Existing without the strategies to the issues you’ve solved by way of the site is a crucial case, and the ones that could have in a wrong way affected my entire career if I had not discovered the website. Your main mastery and kindness in touching every part was invaluable. I’m
    not sure what I would’ve done if I hadn’t encountered such a point like this.
    I am able to at this moment relish my future.
    Thanks for your time very much for the expert and results-oriented help.
    I will not be reluctant to recommend the blog to any individual who
    should receive guidelines on this area.

     
  2. faizaajmal89@gmail.com

    March 18, 2013 at 5:35 pm

    if javascirp is disabled some how in browser then you also clear cache using php headers in your file.
    header(‘Expires: Mon, 26 Jul 1997 05:00:00 GMT’);
    header(‘Last-Modified: ‘ . gmdate(‘D, d M Y H:i:s’) . ‘ GMT’);
    header(‘Cache-Control: no-store, no-cache, must-revalidate’);
    header(‘Cache-Control: post-check=0, pre-check=0’, false);
    header(‘Pragma: no-cache’);

     
    • Sidra Sultana

      March 18, 2013 at 8:40 pm

      good approach of ensuring all possible cases 🙂

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: