Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Reverse DNS lookups w/BrowserHawk
     [next Lesson]  Flash Detection w/BrowserHawk

Handling browsers that do not support frames

Just about all "modern" browsers today support frames.  Unfortunately though there are still several browsers in use today that do not.  Just which ones do and which ones don't?  Well, that's a tricky questions - but fortunately we don't need to concern ourselves with that.

Instead, we simply ask BrowserHawk to determine this for us at run-time, based on the particular browser that a user visits with.  If the browser supports frames, we load the frames set as expected and all is peachy.

If the browser does not support frames, you have a couple of choices on how to handle this.  The easiest thing to do of course is just display a page that tells the user that their browser does not support frames and ask them to upgrade their browser.  Unfortunately this is the least elegant and can leave your visitor soured.   As a result, many developers have two versions of their web site - one that is frames enabled and one that is not.

In this case you use BrowserHawk to determine whether the visitor can support frames.   If they can, you simply load the frameset and off they go.  If they do not support frames, however, then we redirect them to the no frames version of the site. The following code demonstrates this approach.  For simplicity sake we will display text that says to "load the frameset here" rather than actually load a frameset.

   filename=/browserhawk/framestest.asp

<Test Script Below>


<%
set bh = Server.CreateObject("cyScape.browserObj")
if not bh.frames then 'note: this could also be written as  "if bh.frames = false"
   response.redirect "noframes.asp"
end if
%>
<html>

<head>
<title></title>
</head>

<body>

<p>HTML code to load your frameset goes here </p>
</body>
</html>

Need a copy of BrowserHawk? See our section on Getting Started.

Copyright (c) 1999 cyScape, Inc.  All rights reserved.  This material may not be published, distributed, or reprinted without written consent from cyScape.

Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site