Click to return to the Essentials home page    
Web Workshop  |  Essentials

Talk to a Real, Live Web Man


Jeff Brown
Rafael M. Muñoz
Microsoft Corporation

February 27, 1997
Updated: December 15, 1998

The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.

Many of these questions have been asked and answered on the newsgroup set up for MSDN Online Level 2 members. So go check it out if you haven't already! The newsgroup is great as a resource and a place to schmooze with other Web professionals.

Got a query on a Web-site problem? An HTML quandary that another <BR> tag won't solve? A bug that bugs you? Jeff and Rafael, Microsoft's amazing Web Men, walk the walk, and will talk that walk for you. Send your questions--even the ones you're too embarrassed to ask that programmer in the next cubicle--to webmen@microsoft.com. Remember: The Web Men know lots of stuff. If they don't know it, they'll find someone who does. And if not, they're really good at faking it.

Just kidding. Okay, let's go to the phones:

You can count on me

Dear Web Men:

I see a lot of sites that display a counter on the page to indicate how many times the site has been visited. I want to include one on my site. How do they work, and where can I get one?

Frank

The Web Men reply:

Before you start toting up those hits, Frank, be warned that some people discourage the use of visible counters because they can be inefficient and can slow down the Web server. See discussion of this in Boutell.Com, Inc's World Wide Web FAQ at http://www.boutell.com/faq/counters.htm Non-MS link.

However, some of us think counters are really cool anyway, especially ones that are inline images in your page!

Counters come in several varieties. Some concatenate HTML page pieces together to produce an HTML file with the count as regular text. Others return a dynamically created inline .GIF graphic. Both of these are created on the server by a CGI script or an ISAPI application. The count is updated each time the page is displayed or refreshed in a browser.

Another variety of counter updates the statistics dynamically while the user views the page; no refresh is necessary. A Java applet on the page periodically communicates with the server to get an updated count.

Housecleaning

Dear Web Men:

Sometimes while browsing the Web, I visit a page and end up downloading certain ActiveX™ controls to my PC that I later wish I hadn't. How can I remove an ActiveX control?

Heather

The Web Men reply:

Excellent question, Heather! Even though everyone knows ActiveX controls are the greatest invention since sliced bread--well, almost everyone--it is sometimes necessary to expunge one or more from your PC. Maybe you're a neat-freak and don't want an unneeded control taking up space, however little it may be.

However, before you put on the rubber gloves and open up the cleaning fluids (in a well-ventilated area, of course), keep in mind that if you ever visit a Web page that uses the control, you will have to wait for it to download to your PC again. In other words, by removing it, you are circumventing Internet Explorer's automatic caching of ActiveX controls.

But if you're determined, here is a step-by-step method to remove ActiveX controls on a PC running Windows® 95 or Windows NT 4.0:

  1. In Control Panel, double-click Add/Remove Programs, then click the Install/Uninstall tab.
  2. If the ActiveX control you want to remove appears in the list of installed programs, click the control, click Add/Remove, and then follow the instructions on the screen. If the ActiveX control does not appear in the list of installed programs, continue with the next step.
  3. Click the Start button, click Run, type the following line in the Open box
    regsvr32 <windir>\occache\<filename>.ocx /u

    where <windir> is the path to your Windows directory, typically c:\windows for Windows 95 and c:\winnt for Windows NT, and <filename>.ocx is the ActiveX control you want to remove. Then click OK.

    Note: If you do not know the filename for the .OCX file (ActiveX control) you want to remove, you may be able to determine the file name by looking at the HTML source of a Web page that installs or uses the ActiveX control.

  4. Delete the .OCX file in the <windir>\occache folder, where <windir> again is the path to your Windows directory

The steps above were taken from Microsoft Knowledge Base article Q154850, "How to Remove an ActiveX Control in Windows 95." The Knowledge Base can be a great resource for solving problems, as well as for getting current how-to information on all Microsoft products. Check out the Knowledge Base articles sometime soon.

In your face

Dear Web Men:

I want to attract a lot of attention to a particular link on one of my pages by having messages pop up when a surfer passes the mouse cursor over the link. In the future I might want to do other things in response to passing over a link. How can I do this?

Tom

The Web Men reply:

Tom, it seems viewers of your site may suffer from attention-deficit disorder if you need to resort to such tactics, and taunt them to follow a link. But we're glad you asked this anyway. You can use some simple scripting to accomplish this feat.

You need to set up scripting code to handle events for a link object. In this case it is the onMouseOver event that you need to handle.

So how do you hook up to the correct link object on your page? Well, when writing scripting code, in addition to enclosing it in the <SCRIPT> tag, you can actually add event handlers as attributes to certain HTML tags. Pretty cool! In this case, the HTML tag of interest is the anchor tag (<A …>) to specify a link. The following HTML code uses the anchor tag and attaches scripting code to the onMouseOver event of the object that represents the link to coolpage.htm.

<a href="coolpage.htm" 
onMouseOver='alert("Follow this cool link!")'>Cool page!</a>

When you pass the mouse cursor over the Cool page! link, up will pop the message, "Follow this cool link!"

You can generalize this and change the scripting code for onMouseOver to do anything, such as call some other procedures in your scripting code, or whatever you want.

Which side are you on?

Dear Web Men:

I have been creating some wonderful Web pages, but with the differences that still exist between Netscape Navigator and Microsoft Internet Explorer, how can I please both sides of the community when I don't know who is hitting my site with what browser?

Alexis

The Web Men reply:

Alexis, like you, we believe in world harmony. Keeping all sides of the browser community happy is definitely in the best interest of all companies involved, to say nothing of all those innocent bystanders. With a little assistance from the Site Builder Newsgroup, we came up with a sweet little script for determining whether our surfer is using Microsoft Internet Explorer or some other guy's browser. We modified it just slightly and you'll have to "doctor" it up a little (no offense intended to our Microsoft colleague, Dr. GUI). See our comments below in the script.

<SCRIPT LANGUAGE="JavaScript">
<!--
var uagent=navigator.userAgent;
if (uagent.indexOf("MSIE") == 25)
{
 // Checking the use of Internet Explorer!! Yes
 // You would link to your Internet Explorer page.
 // We created a link to the Microsoft Corporate homepage.

 document.writeln('This is the Internet Explorer'+'<br>');
 document.writeln
   ('<A HREF=http://www.microsoft.com/>Microsoft Home Page</a>');
}
else
{
 // Using another browser type.
 // You would link to your Netscape page.
 // We created a link to the Netscape hompage.

 document.writeln('This is not the Internet Explorer'+'<br>');
 document.writeln
   ('<A HREF=http://www.netscape.com/>Netscape Home Page</a>');
}
//-->
</SCRIPT>

As with most good things, there is more than one way to accomplish this. Check the Frequently Asked Questions About HTML Coding for Internet Explorer 3.0 in the Site Builder Workshop for a slightly different variation.

Wishes come true?

Dear Web Men:

I have been writing some really intense Visual Basic® and Java scripts, and debugging them is really a pain. I wish there was a better way to debug scripts in Internet Explorer.

Mark

The Web Men reply:

Hey, Mark, "We don't need no stinkin' debugger!" We thought it was rather fun debugging with brute force, counting the lines in the script to find the problem statements. Breakpoints? What are they for? You mean breaking inside your script while its executing could actually be useful? Well, your wishes have come true.

Check out the Microsoft Script Debugger 1.0, now available in beta version to all those lucky Site Builder Members (guests are welcome, by the way). For more information on this product, check out the Microsoft Script Debugger 1.0 site.

Developing on the edge

Dear Web Men:

I have just created a leading-edge applet, and it requires the latest Microsoft Virtual Machine (VM) for Java to run correctly. How do I make sure that whoever views my page has the latest VM, so that it will run correctly?

Sharon

The Web Men Reply:

Cool, Sharon: an applet living on the edge. After this explanation, I'm sure you'll agree "what an edge." It is possible to add a tag to your HTML that will cause the latest and greatest VM to be automatically installed. The following code snippet shows how, but read on:

<OBJECT
CLASSID= "clsid:08B0E5C0-4FCB-11CF-AAA5-00401C608500"
CODEBASE =
  "http://www.microsoft.com/Java/jvmi386.cab#Version=1,0,0,{ver #}">
</OBJECT>

note:  {ver #}  replace this with the latest VM version 

Alas, trying to stay ahead has it drawbacks. Here are a few things to keep in mind when contemplating whether to do this.

First, this object code must reside on a page that does not contain a Java applet. And while our friendly surfer is coming on your page, he or she must not have passed by any other page that contains a Java applet. Viewing a page with a Java applet causes various files to be loaded; these files remain loaded until Internet Explorer is closed. The HTML code above causes the Virtual Machine to be updated as the page is viewed; if certain files have already been loaded, the updated version will fail.

Second, upgrading also replaces the Classes.zip file, a zipped file containing the Java classes. This file can be found in the operating systems directory under <windows/winnt>/java/classes. Harmless, you say! Did we mention that there are actually two version of this file.

The first version of this file is a "developer's" version, which contains the Java source and byte code for the Java classes. It allows developers to debug into the actual source code.

Then there is the "non-developer" version, which contains only the byte code for the Java classes. This version is loaded with the HTML tag, and is updated with new versions of Internet Explorer or when you install the Microsoft Software Development Kit for Java. Status on the VM can be found at the Microsoft Java Non-MSDN Online link site. Select the Java VM Update link in the left column.

The problem with having two versions is that the installation process doesn't check if the developer's version of Classes.zip has already been installed. It just checks the VM version to see if it needs updating. The VM goes its merry way updating the necessary files, and will write over the "developer's" version. Now, our once-friendly developer could in certain cases occasionally run into the problem of the Java source files not matching up with the actual byte code.

Third, once the upgrade is complete, your computer needs to reboot to complete installation of the new VM. (We didn't say this was going to be easy; you're the one with the leading-edge applet.) After rebooting, your page can be accessed again and your super applet can be seen,. It had really better be great!

So be aware of what's going on. Also try it from your own machine to see exactly how it works. Now, to that once-friendly developer whose file was destroyed goes the question, "Should we really be surfing the Internet with our development machines?"

Jeff Brown, when not forcing family and friends to listen to Zydeco and country blues music, provides technical support for the Microsoft MSDN Online with a smile.

Rafael M. Muñoz (the even bigger smile above) is a part-time Adonis, and full-time support engineer for Microsoft Technical Support. He takes it very, very personally every time you flame Microsoft.

Write us!



Back to topBack to top

Did you find this article useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.