Stop the browser “throbber of doom” while loading comet/server push iframe

前端 未结 4 1567
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 14:07

When using Comet, or Ajax Long Pull techniques - an iframe is usually used. And while that iframe is waiting for the long connection to close, the browser is spinning its th

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 14:23

    I had the same problem, and the solution was to use Ajax instead of hidden iframe. So instead of generating iframe somewhere in the page:

    $("#chat .msg_list").prepend('');
    

    I used jquery ajax call to load iframe contents into some div:

    $('#chat #chat_comet').load('chatFrame?id=$userId');
    

提交回复
热议问题