PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average.

HTC Components with > 512 bytes of javascript slow to unload

 
 
davedave
Guest
Posts: n/a
 
      22nd Sep 2004
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 <publicroperty>, <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>
 
Reply With Quote
 
 
 
 
davedave
Guest
Posts: n/a
 
      28th Sep 2004
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>

--------------------------------------------------------
(E-Mail Removed) (davedave) wrote in message news:<(E-Mail Removed)>...
> 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 <publicroperty>, <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>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is smallest file size 512 or 4096 bytes hubbobubbo@hotmail.com Windows XP General 6 20th Feb 2006 02:30 PM
Is size on disk 512 or 4096 bytes hubbobubbo@hotmail.com Microsoft Windows 2000 File System 1 9th Feb 2006 10:44 AM
SharedSection 1024,3072,512,512 RUG Microsoft Windows 2000 Registry Archive 0 7th Jul 2003 02:12 PM
SharedSection 1024,3072,512,512 RUG Microsoft Windows 2000 Registry Archive 0 7th Jul 2003 02:12 PM
SharedSection 1024,3072,512,512 RUG Microsoft Windows 2000 Registry 0 7th Jul 2003 02:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:56 PM.