on some computers, when a client opens the specific html page, part of the vbscript code on the client side gets trashed with hyphens. i saw that the vbscript code on that page was composed of one huge code section enclosed in script start and end tags. i decided to fragment it to small sections, and it seemed better, but when i fragmeneted it to 10 sections, two of the sections (section means code between start and end tag) were still trashed (meaning the entire section code was replaced with hyphens enclosed with html start and end remark signs: and one of the sections was not so big (maybe 100 lines), surely there were other bigger sections that didn't get corrupted. i can't reconstruct the problem on any computer beside two or three clients, and their patience is a rare resource (which i already used). so, without maneuvering space, should i fragment them some more and hope this will help ? or is it another problem ?
There seems to be some confusion about the script tags and html comments. A client side VBScript tag would look like this:
<script type="text/vbscript"> ... </script>
Or with the older (deprecated) language attribute:
<script language="VBScript"> ... </script>
That is the only type of VBScript that would ever reach the client, provided of course that you put it in an .asp
page. If you put it in an .html
page it will be sent as is to the client without running it through the script engine on the server.
A server side VBScript tag would look like this:
<script runat="server"> ... </script>
Or the short form:
<% ... %>
If you have correct server side script tags in an .asp
page, the code inside will never be visible to the client.
An HTML comment looks like this:
<!-- ... -->
Notice that the hyphens is a part of the HTML comment. The two hyphens at the start turns on the comment mode, and the two hyphens at the end turns off the comment mode. If you have another two hyphens inside the comment, it's broken and is rendered on the page:
<!-- This is not -- a comment -->
However, if you put another pair of hyphens in to turn the comment mode on again, it's a valid comment:
<!-- This is -- -- a comment -->
HTML comments are sometimes used inside script tags, for some historical reason that browsers that doesn't support script should not display the code on the page. This is not needed any more as all browsers nowadays understand the script tag even if they don't run the script. The risk of someone having a 20 year old browser is pretty slim.
If you had a script tag with HTML comments in them, and both the script tag and HTML comment would be broken, it could show up in the browser. Like this:
<scrpt type="text/javascript">
<!--
var i = 1;
i--;
//-->
</script>
Notice that the -- operator in the script is breaking the comment. If the script tag is not broken, it's however not a problem. The browser will not treat the comment inside the script as a real comment, so it doesn't matter that it's broken.
i found out what was the problem. the antivirus supplied by the internet provider decided to neutralize vbscript code whenever it appeared 'suspicious'. so, for example, if the vbscript contained a variable named - swFileExists, the entire vbscript segment turned into a bunch of friendly, unrisky hyphens.