ASP.NET UpdatePanel causes "A script on this page is causing internet explorer to run slowly..." on IE -


ie works slow when there chunk of invalid html code inside updatepanel. interesting point: when ugly html cleared (jquery: $('#content').empty()) before partial postback, ie runs pretty fast , not show "a script..." message.

there 2 buttons in example. first 1 (async) simple partial postback , causes described problem. second 1 (async clear) clears div ugly html , executes partial postback - without problems!

a solution use iframe , load ugly html iframe. more interested in explanation of such behavior.

example aspx markup:

<%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="longrunningjavascript._default" %>  <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <asp:scriptmanager runat="server" id="scriptmanager1">          <scripts>             <asp:scriptreference path="~/scripts/jquery-1.4.1.min.js" />         </scripts>     </asp:scriptmanager>     <div>         <script type="text/javascript">             function remove() {                 $('#content').empty();             }         </script>         <asp:updatepanel runat="server" id="updatepanel1" childrenastriggers="true">             <contenttemplate>                 <asp:button runat="server" id="asyncbutton" text="async" onclick="asyncbutton_click"/>                 <asp:button runat="server" id="asyncwithclearbutton" text="async clear" onclick="asyncbutton_click"  onclientclick="remove();" />                 <div id="content">                   <style>  <!--  v\:* {behavior:url(#default#vml);}  o\:* {behavior:url(#default#vml);}  w\:* {behavior:url(#default#vml);}  .shape {behavior:url(#default#vml);}  -->  </style>  <style>  <!--  /* font definitions */  @font-face   {font-family:wingdings;   panose-1:5 0 0 0 0 0 0 0 0 0;}  @font-face   {font-family:wingdings;   panose-1:5 0 0 0 0 0 0 0 0 0;}  @font-face   {font-family:calibri;   panose-1:2 15 5 2 2 2 4 3 2 4;}  @font-face   {font-family:tahoma;   panose-1:2 11 6 4 3 5 4 4 2 4;}  @font-face   {font-family:verdana;   panose-1:2 11 6 4 3 5 4 4 2 4;}  /* style definitions */  p.msonormal, li.msonormal, div.msonormal   {margin:0cm;   margin-bottom:.0001pt;   font-size:12.0pt;   font-family:"times new xxxxx","serif";}  a:link, span.msohyperlink   {mso-style-priority:99;   color:blue;   text-decoration:underline;}  a:visited, span.msohyperlinkfollowed   {mso-style-priority:99;   color:purple;   text-decoration:underline;}  p.msoacetate, li.msoacetate, div.msoacetate   {mso-style-priority:99;   mso-style-link:"text bubliny char";   margin:0cm;   margin-bottom:.0001pt;   font-size:8.0pt;   font-family:"tahoma","sans-serif";}  span.style-mailovzprvy19   {mso-style-type:personal-reply;   font-family:"calibri","sans-serif";   color:#1f497d;}  span.textbublinychar   {mso-style-name:"text bubliny char";   mso-style-priority:99;   mso-style-link:"text bubliny";   font-family:"tahoma","sans-serif";}  .msochpdefault   {mso-style-type:export-only;   font-size:10.0pt;}  @page wordsection1   {size:612.0pt 792.0pt;   margin:70.85pt 70.85pt 70.85pt 70.85pt;}  div.wordsection1   {page:wordsection1;}  -->  </style>    <div class="wordsection1">     <p class="msonormal"><span style="font-size: 11pt; color: #1f497d; font-family: 'calibri','sans-serif'">     <o:p>&nbsp;</o:p>        <p class="msonormal"><span style="font-size: 11pt; color: #1f497d; font-family: 'calibri','sans-serif'">xxxx xx </span><span style="font-size: 11pt; color: #1f497d; font-family: wingdings">j</span><span style="font-size: 11pt; color: #1f497d; font-family: 'calibri','sans-serif'">        <o:p></o:p>         <p class="msonormal"><span style="font-size: 11pt; color: #1f497d; font-family: 'calibri','sans-serif'">         <o:p>&nbsp;</o:p>            <p class="msonormal"><span style="font-size: 11pt; color: #1f497d; font-family: 'calibri','sans-serif'">xxxxx            <o:p></o:p>             <p class="msonormal"><span style="font-size: 11pt; color: #1f497d; font-family: 'calibri','sans-serif'">             <o:p>&nbsp;</o:p>                <p class="msonormal"><b><span style="font-size: 10pt; font-family: 'tahoma','sans-serif'">from:</span></b><span style="font-size: 10pt; font-family: 'tahoma','sans-serif'"> xxxx@xxx.xx <br />               <b>sent:</b> tuesday, february 01, 2011 4:06 pm<br />               <b>to:</b> xxxxx xxxxx<br />               <b>subject:</b> test akce multimediální přehrávače.                <o:p></o:p></span></p>               <p class="msonormal">              <o:p>&nbsp;</o:p> </?xml:namespace>               <p class="msonormal" style="margin-bottom: 12pt"><br />              <br />              ___________________________________________________________________________<br />              od: xxx@xxxxxy.xx<br />              přijato: 31.01.2011 01:20:44<br />              komu: xxx@xxxxxy.xx<br />              předmět: akce multimediální přehrávače.               <o:p></o:p></p>               <p class="msonormal"><i><span style="font-size: 24pt; color: navy"><img id="_x0000_i1097" height="32" src="cid:avecom_7new1.jpg" width="32" /><em><span style="text-decoration: underline">doporučuje...</span></em></span></i>               <o:p></o:p></p>               <div>                <div>                 <div>                  <div>                   <p class="msonormal">&nbsp;                   <o:p></o:p></p></div>                  <div>                   <p class="msonormal">neumí vaą televizor přehrávat přímo z&nbsp;flashdisku nebo externího hdd ???                   <o:p></o:p></p></div>                  <div>                   <p class="msonormal">připravili jsme pro vás multimediální přehrávače, díky kterým si budete moci uľít vaąe oblíben&eacute; filmy, hudbu fotografie přímo na vaąí tv, monitor (s podporou hdmi dvi)&nbsp;                   <o:p></o:p></p></div>                  <div>                   <p class="msonormal">jednoduch&eacute; připojování umoľňuje proměnit usb flashdisky, externí hdd pamě»ov&eacute; karty na skutečná multimediální úloľiątě.&nbsp;<b><span style="font-size: 11.5pt; color: black">                     <o:p></o:p>                      <div>                       <div class="msonormal" style="text-align: center" align="center"><b><span style="font-size: 11.5pt; color: black">  <hr align="center" width="100%" size="2" />                        </span></b></div></div>                      <div>                       <div>                        <div>                         <div>                          <div>                           <div>                            <div>                             <div>                              <div>                               <div>                                <div>                                 <p class="msonormal"><b><span style="font-size: 11.5pt; color: fuchsia">genius media player 200, hdmi, přehrávání hudby, videa, fotek z pamě»ových karet, externích hdd.                                   <o:p></o:p></span></b></p></div></div>                               <div>                                <div>                                 <div>                                  <div>                                   <div>                                    <div>                                     <div>                                      <p class="msonormal"><b><span style="font-size: 11.5pt; color: red"><img id="_x0000_i1099" height="32" src="cid:37158a.jpg" width="32" /></span></b><b><span style="font-size: 11.5pt; color: fuchsia">                                        <o:p></o:p>                                         <div>                                          <p class="msonormal"><b><span style="font-size: 11.5pt; color: red">cena:&nbsp;999,00kč bez dph </span></b><b><span style="font-size: 11.5pt; color: blue">(1 199,00kč s dph)</span></b><b><span style="font-size: 11.5pt; color: fuchsia">                                            <o:p></o:p>                                             <div>                                              <p class="msonormal"><b><span style="font-size: 11.5pt; color: fuchsia">&nbsp;                                                <o:p></o:p>                                                 <div>                                                  <p class="msonormal"><b><span style="font-size: 11.5pt; color: black">kompaktní přehrávač, který si poradí se spousty multimediálními formáty. podporuje video soubory ve formátech dvd disků, pokročilý mpeg-4 formát (h.264), oblíben&eacute; komprese divx xvid rovněľ formáty real media v rozliąení aľ 1024 x 576 bodů. z hudebních souborů jsou pak např. populární mp3 wma. v neposlední řadě přehrávač dovolí prohlíľení obrazářů fotografií ve formátech bmp, jpeg png. nechybí podpora textových souborů několik formátů titulek. ke sv&eacute;mu televizoru přehrávač připojíte pomocí hdmi nebo komponentního výstupu. v rozhraní potěąí usb vstup pro připojení externích datových úloľią» slot na pamě»ov&eacute; karty typu ms/sc/mmc. přehrávač je dodáván s dálkovým ovladačem.<br />                                                   <br />                                                   </span></b><b><span style="font-size: 11.5pt; color: blue">podporovan&eacute; formáty:<br />                                                   video: </span></b><b><span style="font-size: 11.5pt; color: black">rm/rmvb, mpeg 1/2 (dat, vob, mov), mpeg4 (avi, divx , xvid), </span></b><b><span style="font-size: 11.5pt; color: blue">audio: </span></b><b><span style="font-size: 11.5pt; color: black">mp3, wma, aac, ac3, wav, </span></b><b><span style="font-size: 11.5pt; color: blue">foto: </span></b><b><span style="font-size: 11.5pt; color: black">bmp, jpeg, png, </span></b><b><span style="font-size: 11.5pt; color: blue">text: </span></b><b><span style="font-size: 11.5pt; color: black">txt, srt, sub, ssa, ass, smi<br />                                                   </span></b><strong><span style="font-size: 11.5pt; color: blue">rozhraní: </span></strong><b><span style="font-size: 11.5pt; color: black">1x hdmi výstup, 1x komponentní výstup (y, pr, pb), 1x kompozitní a/v výstup (rca konektory), 1x usb vstup, 1x slot na pamě»ov&eacute; karty ms/sd/mmc<br />                                                   </span></b><strong><span style="font-size: 11.5pt; color: blue">rozměry: </span></strong><b><span style="font-size: 11.5pt; color: black">27 x 35 x 7 cm (v x &copy; x h)<br />                                                   </span></b><strong><span style="font-size: 11.5pt; color: blue">hmotnost: </span></strong><b><span style="font-size: 11.5pt; color: black">1,3 kg<br />                                                   </span></b><strong><span style="font-size: 11.5pt; color: blue">dodávan&eacute; přísluąenství: </span></strong><b><span style="font-size: 11.5pt; color: black">dálkový ovladač</span></b><b><span style="font-size: 11.5pt; color: fuchsia">                                                    <o:p></o:p>                                                     <div>                                                      <div>                                                       <p class="msonormal"><b><span style="color: black; text-decoration: underline">kód zboľí:</span><span style="color: blue">&nbsp;37158</span></b><b><span style="font-size: 11.5pt; color: black">&nbsp;                                                         <o:p></o:p></span></b></p></div></div>                                                     <div>                                                      <div>                                                       <div>                                                        <p class="msonormal"><b><span style="color: black">moľnost objednání (po registraci)&nbsp;a podrobný popis&nbsp;</span><span style="color: blue; text-decoration: underline"><a href="http://www.avekom.cz/product/37158/2/genius-media-player-200-hdmi-prehravani-hudby-videa-fotek-z-pametovych-karet-externich-hdd">zde</a></span></b><b><span style="font-size: 11.5pt; color: black">                                                          <o:p></o:p>                                                           <div>                                                            <div>                                                             <div>                                                              <div>                                                               <div>                                                                <div>                                                                 <div class="msonormal" style="text-align: center" align="center"><b><span style="font-size: 11.5pt; color: black">  <hr align="center" width="100%" size="2" />                                                                  </span></b></div>                                                                 <div>                                                                  <p class="msonormal"><b><span style="font-size: 11.5pt; color: fuchsia">asus o!play mini multimedialni prehravac fullhd 1080p usb (mini/1a/pal/hdmi/as mediaplayer)                                                                    <o:p></o:p></span></b></p></div>                                                                 <div>                                                                  <p class="msonormal"><b><span style="font-size: 11.5pt; color: fuchsia"><img id="_x0000_i1101" height="32" src="cid:37632.jpg" width="32" border="0" />&nbsp;                                                                    <o:p></o:p></span></b></p></div>                                                                 <div>                                                                  <div>                                                                   <p class="msonormal"><b><span style="font-size: 11.5pt; color: red">cena:&nbsp;1 299,00kč bez dph </span></b><b><span style="font-size: 11.5pt; color: blue">(1 599,00kč s dph)</span></b><b><span style="font-size: 11.5pt; color: fuchsia">                                                                     <o:p></o:p>                                                                      <div>                                                                       <p class="msonormal"><b><span style="font-size: 11.5pt; color: fuchsia">&nbsp;                                                                         <o:p></o:p>                                                                          <div>                                                                           <p class="msonormal"><b><span style="font-size: 11.5pt; color: black">výrazně zmenąená verze populárního multimediálního přehrávače asus o!play, která váľí pouze 175 g vejde se vám dlaní! tak si přehrávač zachoval svou největąí přednost podporuje full hd rozliąení 1080p 7.1kanálový zvuk dolby truehd, který zaručuje audiovizuální záľitky srovnateln&eacute; s návątěvou kina. podporuje celou řadu video formátů v populárních kodecích xvid, divx v pokročil&eacute;m h.264 jako např. avi, vob (pro dvd), mpg, mp4 či vysoce kvalitní mkv. nem&eacute;ně početná podpora formátů se týká audio souborů, kter&eacute; si budete moci přehrávat např. mp3, wav, ogg, wma nebo aac. nechybí moľnost prohlíľení digitálních fotografií jpeg, obrázků bmp, gif tiff.<br />                                                                            jelikoľ přehrávač disponuje opravdu miniaturními rozměry, tak ho není moľn&eacute; osadit interním pevným diskem. datový obsah vąak můľete přehrávači dodávat pomocí flashdisků, externích hdd anebo pamě»ových karet několika druhů, díky přednímu usb 2.0 portu respektive vestavěn&eacute; čtečce karet. propojení s televizorem obstará hdmi výstup ve verzi 1.3 nebo komponentní kompozitní výstup. optický digitální audio výstup dobře poslouľí např. k posílání digitálního signálu vaąeho receiveru. přehrávač je dodáván s dálkovým ovladačem.<br />                                                                            <br />                 </div>             </contenttemplate>         </asp:updatepanel>     </div>     </form> </body> </html> 

code behind:

using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols;  namespace longrunningjavascript {     public partial class _default : system.web.ui.page     {         protected void page_load(object sender, eventargs e)         {         }          protected void asyncbutton_click(object sender, eventargs e)         {         }     } } 

tested in ie6 , ie8, asp.net 3.5, iis7.5 (integrated).

this clear code ms

function sys$webforms$pagerequestmanager$_updatepanel(updatepanelelement, rendering) {         (var updatepanelid in this._scriptdisposes) {             if (this._elementcontains(updatepanelelement, document.getelementbyid(updatepanelid))) {                 var disposescripts = this._scriptdisposes[updatepanelid];                 (var = 0, l = disposescripts.length; < l; i++) {                     eval(disposescripts[i]);                 }                 delete this._scriptdisposes[updatepanelid];             }         }         sys.application.disposeelement(updatepanelelement, true);         updatepanelelement.innerhtml = rendering;     } 

it doing quite more stuff jquery, since might have initialized scripts in updatepanel, disposed. after that, setting innerhtml not best way, maybe it´s little slow.

if use jquery clear stuff, , may have scripts loaded it, not disposed (destroyed)...

you find code , check if it´s section makes slowness, dont know.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -