Jeff Brown
Rafael M. Muņoz
Microsoft Corporation
May 12, 1997
The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.
Contents
Frame frenzy gone mad - Frequently asked frame questions
Don't I know you? - Recognizing browser type
Wowing the bosses - Internet Explorer in Kiosk Mode
Motion pictures - Displaying images with Java
Hexed by a wizard - Borderless frames with FrontPage 97
For the love of ASP - ASP and content types
Enough already! - Limiting records returned by IDC
It's time for the Web Men to come out. This week, they go bi-bi.
Bi-weekly, that is. Yep, from now on, look for a new Web Men Talking column to come out every other week, instead of every month. You've asked MSDN Online Voices's irrepressible Answer Guys so many good questions, they're working twice as hard to get you the right answers, like how to cope with frame frenzy! -- Editor
A mistake on the last column? Well, sort of. We want to thank Matt Carpenter for bringing to our attention a minor download delay situation with the sample for the Staying organized answer in our last column. As Matt put it so gracefully, a "BIG HONKIN'" component was being downloaded. Somehow the old Microsoft Agent found his way into our sample. After being notified of the situation, we promptly put the Genie back in his bottle. Hey--it's our first mistake, and it will never happen again (yeah, and if you believe that!). We hope nobody was terribly bothered by the Genie, or at least made three wishes.
Dear Web Men:
Is it possible to assign a frame to scroll only in the horizontal direction?
Mike Costantino
When you use frames, do the margin width and height attributes really work?
Anonymous
..how I could create a link that would open one document in one frame and a different document in another.
Jane Knight
Jack Gorman
Jerome Tillotson
...would like to set up the page so that all the frames are cleared before the link is connected, and the linked page is displayed on its own page...
Mike Nyman
Nelson Avelar
Dave Holland
Wahyu Hidarto
The Web Men reply:
Do we see a trend here? The world is going mad about frames. Here a frame, there a frame, everywhere a frame, frame. Do you get the feeling that frame questions are pretty popular? Cool, then we've made our point. As you can see, we have given a lot of people credit for these questions. (We would also like to thank Mike Castantino for his question and for answering his own question three days later. Who could ask for more?)
In response, we have created a super colossal sample to answer all your frame worries. The sample is documented page by page, with script code where necessary. We just walked through each question and wrote the Book on Frames!
In our archived column Some Code to Go with that Java? we list another great site for information on frames -- Joe Barta's Frames Tutor , which contains tutorials on Frames, as well as on Forms and Tables.
Dear Web Men:
Hello, I was wondering if you know a way a site can have the ability to recognize the type of browser being used to view it, and thus load either a text-based or frame-based version of the site. Could this be achieved using Perl, and if so, do you have any samples--or any suggestions where I could go to find some? All suggestions would be gratefully received.
Cheers,
Simon Fulford
The Web Men reply:
You may already realize this--but we thought we should mention it: The simplest solution is to use the NOFRAMES HTML tag in order to include content for a browser that does not support frames. Browsers that support frames just ignore the HTML surrounded by the NOFRAMES tag, and display the frames you specified in your frameset. Refer to your favorite HTML reference for more details.
However, browser detection is still a great way to return completely different pages automatically, depending on the capabilities of the browser. And yes, you can do this by writing a Common Gateway Interface (CGI) application using Perl.
Browsers identify themselves to the server by sending their name and version in the HTTP User Agent header. This corresponds to the HTTP_USER_AGENT environment variable that your Perl script would examine. The script would compare the string in HTTP_USER_AGENT to a list of strings of different browsers. The list would include browsers you knew supported frames or other capabilities in which you were interested. You might be able to find a script of this sort by searching Yahoos CGI - Common Gateway Interface listing .
If you were using Internet Information Server (IIS) , you could do all this very simply with Active Server Pages (ASP). ASP provides a built-in browser capabilities component, which you can use to determine whether a browser supports frames, scripting, Java applets, ActiveX controls, and so forth, and then dynamically generate content the browser is capable of viewing. For more information on ASP, read An ASP You Can Grasp: The ABCs of Active Server Pages.
Another approach is to include client-side scripting in your pages to detect the type of browser. The script could load different pages depending on the browser being used. Of course this approach is not as generic, because it assumes the browser can interpret script.
For more details on this method, read the Authoring For Multiple Browsers section of Frequently Asked Questions About HTML Coding for Internet Explorer, and check out Microsoft Knowledge Base article Q167820, "Determining Browser Version from a Script" .
Dear Web Men:
I could really wow the budget makers if I could show them an HTML presentation in Kiosk Mode. I found a great example of this on the VBScript/ActiveX Demo, by JWalk & Associates. The problem is the method demonstrated there does not seem to work in Internet Explorer 3.02, which makes me also wonder about Internet Explorer 4.0.
How can I place all three (3.01, 3.02, and 4.0) into and out of Kiosk Mode?
Any words of wisdom would be greatly appreciated.
Mike Jackson
The Web Men reply:
Mike, thanks for your mail, and we just want to say we were really sorry to hear about you and Lisa Marie. We were really pulling for you. All right, you've probably heard all the Michael Jackson jokes, right? Please accept our gracious apologies.
So you want to wow the budget makers, the bosses, the big cheese in charge, eh? For those of you who aren't familiar with the term Kiosk Mode, it is, simply put, running Microsoft Internet Explorer in a full screen mode where the Windows desktop is inaccessible until you quit Internet Explorer. A great source of information on this can be found in the Microsoft Knowledge Base article "How to Use Kiosk Mode in Microsoft Internet Explorer 3.0," Q154780 .
When Internet Explorer 3.01 was available, designers had access to the Explorer property, an undocumented property, of the HTML Scripting Object Model document object. All undocumented features should be approached with extreme caution because they are always subject to change. That is exactly what happened with the Explorer property when Internet Explorer 3.02 was made available: The Explorer property was removed. For more information on why, see the Knowledge Base article "PRB: Internet Explorer Returns Object Required: 'Explorer,'" Q166367 .
To direct our attention to your first observation, Mike, examples of Kiosk Mode written for Internet Explorer 3.01 will not work in 3.02. But in the article mentioned above, Q166367, a script is provided to simulate the Kiosk Mode in both 3.01 and 3.02. The article also provides script-based workarounds for a number of common uses for the Explorer property. Take note, we are only talking about entering Kiosk Mode from within a script in the browser. You can always enter kiosk mode by launching the browser with the -k command line option (see article Q154780 again).
Since Internet Explorer 4.0 is still in beta, we need to take the same caution used with undocumented features. So at this time, we don't have a sure way to simulate Kiosk Mode, but we will be the first to bring it to you when we get one. We would also suggest checking back with article Q166367 for an update when Internet Explorer 4.0 is released.
Dear Web Men:
How do I make a Java applet with a picture that changes when I move the cursor over? Is it even possible?
Tyler Sweet
The Web Men reply:
This is definitely possible with a Java applet. In general, you can create an array of Image objects to load the pictures, and use the MediaTracker class to manage them. If your applet is just going to do this one thing--change pictures--then you can limit its applet window to the size of the pictures, and change the picture in the mouseEnter method of the applet class. If the applet is going to do other things with its user interface, you need to take a different approach.
To be specific (as we always like to be), we have modified a Java applet generated by the Java Applet Wizard that comes with Microsoft Visual J++. You can use this wizard to generate a starter Java project for you that includes animation.
We changed the code to use a smaller set of pictures, and instead of automatically cycling through the pictures in the run method, as you would do for animation, we change the picture in the mouseEnter method. The picture will only change when you move the mouse cursor from outside the edge over the image.
You may want to try out the Trial Edition of Visual J++. It is available free to members of MSDN online. Go to the Visual J++ Start Page for more information. (If you're not yet a Site Builder Network member, why not become a Guest Member?)
We also recommend you take a gander at our past column on resources for learning Java. In our Old-timers watch out answer, we included links to some great Java resources.
Java programmers who want access to much more powerful animation services than those in the Java Abstract Windowing Toolkit (AWT) should take a look at the Direct Animation Java libraries. These are new Java classes currently available in the Microsoft SDK for Java 2.0.
Dear Web Men:
I can hold my own when it comes to coding, but I like to see what I am getting sometimes and for this I use FrontPage 97. I was wondering if there is a way to create a borderless frame set, using the wizard that comes with it.
Thanks,
Billy Donaldson
The Web Men reply:
I wonder if the great and powerful Merlin can get us out of this predicament. Oh, the joy of wizards. They can make our lives so easy and then they hide so much. You C++ programmers can relate to this one. Remember what it took to create a multiple document interface (MDI) application? Then came the Microsoft Foundation Classes (MFC) and the application wizards and about seven mouse clicks later you could have a running MDI application.
As Billy pointed out, FrontPage 97 also has wizards. With the frame wizard, about seven mouse clicks, and no HTML editing, you can have a working Web page that contains frames. The only problem is that this process tends to hide a lot from the user (that's you and me). So how do we get to the meat of things and make our frames borderless?
For those of you who have to catch up and create that page, check the help in FrontPage 97 to get the steps for creating a frameset. Those of us who already have our pages can bring them up in the FrontPage Explorer.
Right click on your page and from the context menu choose "Open with...," this displays the Open With Editor dialog box. Choose the FrontPage Editor, which will cause your page to be loaded into the Editor. Trying to open this page directly with the Editor will cause the wizard to be run again, and you can't make the appropriate changes from within the wizard. From the Editor's menu select "View.HTML..." This will bring up the View or Edit HTML window and now we can see the actual HTML. Now we can make all the necessary changes to create borderless frames. Ah, and for that information we are going to direct you to our column Some Code to Go with that Java? where we give you all the necessary attributes to create borderless frames.
Dear Web Men:
I love Active Server Pages. I try to make all of my pages dynamic in some way, but how can I return content types other than HTML (e.g. VRML)?
Erkan Izat
The Web Men reply:
We are touched to hear you love Active Server Pages, Erkan. We think it's a pretty great technology, too.
You can return other content types from Active Server Pages (ASP) by setting the ContentType property of the Response object to whatever type you are returning. You would precede VRML (Virtual Reality Modeling Language) content with this statement:
<% Response.ContentType = "x-world/x-vrml" %>
If you didnt do this, ASP would treat the content as HTML (text/HTML).
Another way to return VRML would be to use the Redirect method of the Response object to return a complete VRML file directly, like this:
<% Response.Redirect "3dobjects.wrl" %>
Internet Information Server (IIS) is already set up to automatically return the correct MIME type (a.k.a. Media Type) for VRML files.
If at some point you need to return a new type of content, and it does not have a MIME type in the IIS MimeMap in the Windows registry, refer to Microsoft Knowledge Base article Q142558, "Adding Mime Types to Internet Information Server" .
Setting the content type--either explicitly or automatically--enables the browser to detect that the server is sending a VRML file and can start the appropriate player for it. If a VRML player is available to the browser it will use it to render the 3D world described by the VRML. If one is not available, the browser may prompt you to open the file.
For more information on content types and the Response object, refer to the ASP Roadmap documentation.
For those interested in VRML, check out current developments with the VRML standardization process at the VRML Consortium site . Also, check out the Silicon Graphics VRML site for lots of useful information and a large index of virtual worlds. Find out about Microsoft efforts to support VRML at the Microsoft VRML home page .
Dear Web Men:
When using an Internet Database Connector (IDC) and an HTX query results file, how do I limit the number of records being returned?
Example: We have a Real Estate database on-line that will return property records along with pictures in a given price range. If a user enters a really broad price range (100,000 to 200,000), it may take the 5 or 10 minutes for the HTX results file to load because 35+ records are being returned.
How do I make the IDC file return only 5 records at a time with a link to go to the next 5 and then the next 5 and so on? I have seen other sites that do this with a CGI script, but I can't figure this out! Can you help me?
Thanks,
Kelly Shuford
The Web Men reply:
Kelly, the only way you can limit records is using the MaxRecords parameter in your IDC file. But that will not give you the user interface you are looking for. The IDC is not set up to produce multiple pages of output.
We suggest you start using Active Server Pages (ASP), which is a much more powerful technology. There is even a tool that will convert your IDC and HTX files to equivalent ASP code. Go check out the IDC/HTX to ASP converter (IDC2ASP).
There is also a sample in the ASP Roadmap documentation that demonstrates how to produce multiple pages of output from a single query, as you wish to do. Go to the More Samples page in the Roadmap, and follow the link for the "ADO SQL Query Form with Scrollable Results" sample.
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.