browser compatibility issue

Discussion in 'PHP' started by 3.5supersonic, Jun 24, 2010.

  1. #1
    Hi i have this code in my php file and it does work greatly on Firefox and not in IE,
    IE doesn't reload div with this javascript

    <?php
    print <<<HERE
    <script type="text/javascript">
    $(document).ready(function() {
    $("#loader").load("content.php?uname=$uname");
    var refreshId = setInterval(function() {
    $("#loader").load("content.php?uname=$uname");
    }, 5000);
    });
    </script>
    HERE;
    ?>

    <div id="loader"></div>

    how can i make this work on IE?

    Thanks.
     
    3.5supersonic, Jun 24, 2010 IP
  2. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use a string expression for setInterval.

    May move $("#loader").load("content.php?uname=$uname"); to a function. Would even look nicer.
     
    flexdex, Jun 24, 2010 IP
  3. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i tried like this

    <?php
    print <<<HERE
    <script type="text/javascript">

    setInterval("calldiv()", 5000);

    function calldiv(){

    $("#loader").load("content.php?uname=$uname");

    }


    </script>
    HERE;
    ?>

    <div id="loader"></div>

    this didnt work too :(
     
    3.5supersonic, Jun 24, 2010 IP
  4. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The id "loader" seems to be unknown at execution time. Move it to domReady or put div before script
     
    flexdex, Jun 24, 2010 IP
  5. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    weird thing is if i open new tab on IE8 it works, seems like IE8 freeze codes after first execution and then it works if i do some activity with browser :(

    but in firefox code works perfectly without any problem.
     
    3.5supersonic, Jun 24, 2010 IP
  6. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    found problem and it was due to IE cache content.php and it doesnt load on intervals :(

    any idea to prevent those php files from cache by IE ?
     
    3.5supersonic, Jun 24, 2010 IP
  7. clox.c

    clox.c Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    m.. i guess caching is something related to IE settings, isn't it?
     
    clox.c, Jun 24, 2010 IP
  8. KimiGermany

    KimiGermany Peon

    Messages:
    1,117
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I had this problem too, the fix was changing something in css file. I forgot what lol already a while ago.
     
    KimiGermany, Jun 24, 2010 IP
  9. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    yeah but looking for a way to do that with page since i can not tell users to stop browser cache to view my page.
     
    3.5supersonic, Jun 24, 2010 IP
  10. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #10
    Not sure if it works on all browser, but you can tell browsers not to cache through meta tags.

    Have a look here http://www.i18nguy.com/markup/metatags.html
     
    MyVodaFone, Jun 25, 2010 IP
  11. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    after spending whole night looking for a solution, i found a fix by sending POST variable with load ()

    Thanks for all who support :)
     
    3.5supersonic, Jun 25, 2010 IP