HTC Components with > 512 bytes of javascript slow to unload

Discussion in 'Windows XP Internet Explorer' started by davedave, Sep 22, 2004.

  1. davedave

    davedave Guest

    When using large number of copies of a lightweight HTC behavior
    component that contains more than 512 bytes of javascript code, the
    page takes a LONG time to unload the page (such as by closing the
    window, refreshing the page, navigating elsewhere, etc). In the
    example below, running on my machine, it takes about 0.02 seconds /
    component to unload the page, making the component pretty unusable.
    If I shrink the javascript code below the 512 byte limit, it will
    unload instantly.

    The 512 byte limit only affects the contents of the <script
    language=javascript></script> section of the behavior. You can have
    as many <public:property>, <public:method>, or <public:attach> tags as
    you want without affecting unload speed.

    This is only a problem when using Javascript or JScript as the
    scripting language. Rewritting the component to use VBScript fixes
    the problem.

    Also, for some silly reason, including a blank <script
    language=VBScript></script> before the <script language=javascript>
    tag inside the component also fixes the problem.

    My environment: IE6 on Win2k with all patches.

    The following will unload slowly. Taking out the "Z" in the first
    line of javascript code below will fix everything.

    MyPage.asp:
    -------------------------------
    <html>
    <head>
    <style>
    .MyClass {behavior:url('MyBehavior.htc');
    </style>
    </head>

    <body>
    <%
    for i = 1 to 500
    Response.Write "<input type=text class=MyClass><br>"
    next
    %>
    </body>
    </html>

    MyBehavior.htc:
    -------------------------------
    <public:component lightweight=true>
    <script language=javascript>
    var Zaaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddd;
    function aaaaaaaaaaaaaaa() {};
    function bbbbbbbbbbbb() {};
    function cccccccccccccc() {};
    function ddddddddddddddddddd() {};
    function eeeeeeeeeeeeee() {};
    function ffffffffffffffffffff() {};
    function ggggggggggggggggg() {};
    function hhhhhhhhhhhhhhh() {};
    function iiiiiiiiiiiiii() {};
    function jjjjjjjjjjjjjjjjj() {};
    function kkkkkkkkkkkk() {};
    function llllllllll() {};
    function mmmmmmmmmmmmmmmm() {};
    function zzzzzzzzzz1() {};
    </script>
    </public:component>


    this version of MyBehavior.htc works fine:
    -------------------------------
    <public:component lightweight=true>
    <script language=javascript>
    var aaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddd;
    function aaaaaaaaaaaaaaa() {};
    function bbbbbbbbbbbb() {};
    function cccccccccccccc() {};
    function ddddddddddddddddddd() {};
    function eeeeeeeeeeeeee() {};
    function ffffffffffffffffffff() {};
    function ggggggggggggggggg() {};
    function hhhhhhhhhhhhhhh() {};
    function iiiiiiiiiiiiii() {};
    function jjjjjjjjjjjjjjjjj() {};
    function kkkkkkkkkkkk() {};
    function llllllllll() {};
    function mmmmmmmmmmmmmmmm() {};
    function zzzzzzzzzz1() {};
    </script>
    </public:component>

    and for some silly reason, this works fine:
    -------------------------------
    <public:component lightweight=true>
    <script language=VBScript></script>
    <script language=javascript>
    var Zaaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddd;
    function aaaaaaaaaaaaaaa() {};
    function bbbbbbbbbbbb() {};
    function cccccccccccccc() {};
    function ddddddddddddddddddd() {};
    function eeeeeeeeeeeeee() {};
    function ffffffffffffffffffff() {};
    function ggggggggggggggggg() {};
    function hhhhhhhhhhhhhhh() {};
    function iiiiiiiiiiiiii() {};
    function jjjjjjjjjjjjjjjjj() {};
    function kkkkkkkkkkkk() {};
    function llllllllll() {};
    function mmmmmmmmmmmmmmmm() {};
    function zzzzzzzzzz1() {};
    </script>
    </public:component>
     
    davedave, Sep 22, 2004
    #1
    1. Advertisements

  2. davedave

    davedave Guest

    Correction: you need to put the <script language=VBScript></script>
    code AFTER your javascript code or the behavior will stop working
    under some circumstances (if anyone from Microsoft is actually looking
    at this, feel free to contact me for more details).

    Works:
    <public:component lightweight=true>
    <script language=javascript>
    // Your code here
    </script>
    <script language=VBScript></script>
    </public:component>

    Doesn't always work:
    <public:component lightweight=true>
    <script language=VBScript></script>
    <script language=javascript>
    // Your code here
    </script>
    </public:component>

    --------------------------------------------------------
    (davedave) wrote in message news:<>...
    > When using large number of copies of a lightweight HTC behavior
    > component that contains more than 512 bytes of javascript code, the
    > page takes a LONG time to unload the page (such as by closing the
    > window, refreshing the page, navigating elsewhere, etc). In the
    > example below, running on my machine, it takes about 0.02 seconds /
    > component to unload the page, making the component pretty unusable.
    > If I shrink the javascript code below the 512 byte limit, it will
    > unload instantly.
    >
    > The 512 byte limit only affects the contents of the <script
    > language=javascript></script> section of the behavior. You can have
    > as many <public:property>, <public:method>, or <public:attach> tags as
    > you want without affecting unload speed.
    >
    > This is only a problem when using Javascript or JScript as the
    > scripting language. Rewritting the component to use VBScript fixes
    > the problem.
    >
    > Also, for some silly reason, including a blank <script
    > language=VBScript></script> before the <script language=javascript>
    > tag inside the component also fixes the problem.
    >
    > My environment: IE6 on Win2k with all patches.
    >
    > The following will unload slowly. Taking out the "Z" in the first
    > line of javascript code below will fix everything.
    >
    > MyPage.asp:
    > -------------------------------
    > <html>
    > <head>
    > <style>
    > .MyClass {behavior:url('MyBehavior.htc');
    > </style>
    > </head>
    >
    > <body>
    > <%
    > for i = 1 to 500
    > Response.Write "<input type=text class=MyClass><br>"
    > next
    > %>
    > </body>
    > </html>
    >
    > MyBehavior.htc:
    > -------------------------------
    > <public:component lightweight=true>
    > <script language=javascript>
    > var Zaaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddd;
    > function aaaaaaaaaaaaaaa() {};
    > function bbbbbbbbbbbb() {};
    > function cccccccccccccc() {};
    > function ddddddddddddddddddd() {};
    > function eeeeeeeeeeeeee() {};
    > function ffffffffffffffffffff() {};
    > function ggggggggggggggggg() {};
    > function hhhhhhhhhhhhhhh() {};
    > function iiiiiiiiiiiiii() {};
    > function jjjjjjjjjjjjjjjjj() {};
    > function kkkkkkkkkkkk() {};
    > function llllllllll() {};
    > function mmmmmmmmmmmmmmmm() {};
    > function zzzzzzzzzz1() {};
    > </script>
    > </public:component>
    >
    >
    > this version of MyBehavior.htc works fine:
    > -------------------------------
    > <public:component lightweight=true>
    > <script language=javascript>
    > var aaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddd;
    > function aaaaaaaaaaaaaaa() {};
    > function bbbbbbbbbbbb() {};
    > function cccccccccccccc() {};
    > function ddddddddddddddddddd() {};
    > function eeeeeeeeeeeeee() {};
    > function ffffffffffffffffffff() {};
    > function ggggggggggggggggg() {};
    > function hhhhhhhhhhhhhhh() {};
    > function iiiiiiiiiiiiii() {};
    > function jjjjjjjjjjjjjjjjj() {};
    > function kkkkkkkkkkkk() {};
    > function llllllllll() {};
    > function mmmmmmmmmmmmmmmm() {};
    > function zzzzzzzzzz1() {};
    > </script>
    > </public:component>
    >
    > and for some silly reason, this works fine:
    > -------------------------------
    > <public:component lightweight=true>
    > <script language=VBScript></script>
    > <script language=javascript>
    > var Zaaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddd;
    > function aaaaaaaaaaaaaaa() {};
    > function bbbbbbbbbbbb() {};
    > function cccccccccccccc() {};
    > function ddddddddddddddddddd() {};
    > function eeeeeeeeeeeeee() {};
    > function ffffffffffffffffffff() {};
    > function ggggggggggggggggg() {};
    > function hhhhhhhhhhhhhhh() {};
    > function iiiiiiiiiiiiii() {};
    > function jjjjjjjjjjjjjjjjj() {};
    > function kkkkkkkkkkkk() {};
    > function llllllllll() {};
    > function mmmmmmmmmmmmmmmm() {};
    > function zzzzzzzzzz1() {};
    > </script>
    > </public:component>
     
    davedave, Sep 28, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andre Fernandes

    IE6-HTC Crash

    Andre Fernandes, Jul 31, 2003, in forum: Windows XP Internet Explorer
    Replies:
    1
    Views:
    336
    H Leboeuf
    Aug 1, 2003
  2. Alex Rau

    HTC tool to use

    Alex Rau, Aug 14, 2003, in forum: Windows XP Internet Explorer
    Replies:
    1
    Views:
    201
    Steven Liu [MSFT]
    Aug 14, 2003
  3. Garrison Roberts

    DHTML Behavior downloads HTC file multiple times

    Garrison Roberts, Jan 19, 2004, in forum: Windows XP Internet Explorer
    Replies:
    0
    Views:
    349
    Garrison Roberts
    Jan 19, 2004
  4. Mike

    IE6 problem with htc

    Mike, Feb 4, 2004, in forum: Windows XP Internet Explorer
    Replies:
    1
    Views:
    216
    H Leboeuf
    Feb 5, 2004
  5. Colin Green

    Using HTC's in design mode

    Colin Green, Jun 18, 2004, in forum: Windows XP Internet Explorer
    Replies:
    0
    Views:
    228
    Colin Green
    Jun 18, 2004
Loading...

Share This Page