Frames
by Don Singleton

I do not normally like the HTML Tool called Frames, because it prevents the viewer from bookmarking an internal page (unless he knows what he is doing), or referring a friend to a specific article, but when we began featuring photos on the cover, and checking the reader screen resolution to direct them to a page that had the link boxes positioned over the cover photo appropriately for the screen resolution it became an annoyance that they would see the cover page as http://tulsahightech.com/2009nn/800.htm, 1024.htm, 1280.htm, or 1600.htm, depending on their screen resolution, because if they bookmarked that page, and came back the next month, they would see last month's issue, and if they bookmarked an issue at one screen resolution, and then came back at a different screen resolution, the boxes would be in the wrong place.

I could not think what to do, until someone emailed me: With Reference your Screen Resolution page, thank you for giving me your precious time.

I know it switches the browser to a different page, thus the address bar changes.

The problem is, I'm not used to using XHTML frames (nor javascript)

My website is based on a single Flash movie, embedded in html pages. Now, I've made several sizes of the Flash movie, and embedded them in their respective pages.

But the problem i'm having is, since its the homepage, I want the domain to keep showing 'http://www.homepage.com' instead of 'http://www.homepage.com/xxxsize.html'

I got the idea of using frames from some forums, but since its a little complicated because I'm using your script to redirect the page to the specific resolution one, I came to you for help.. Can you show me a simple demo involving 2 pages, and a mainpage where the frame will be nested holding the Flash movie with a working modded script of yours.

I'll really Appreciate.

I certainly used Javascript to do the screen resolution test, as I described in an article in March, but I was not using Frames, XHTML or other, but a lightbulb turned on in my head:

I could have my cake and eat it too. I could use Frames, which I hated, as long as they did what I needed, and then abandon them (break out of frames), once they no longer did what I wanted. So beginning with the May issue, the root folder has an html file called index.htm which reads:

<html>
<head>
</head>
<frameset cols="*">
<frame src="200905/index.htm">
</frameset>
</html>

So if you read the index page at 800x600 you will really go to http://tulsahightech.com/200905/index.htm, but that page has <script type="text/javascript" src="screenRes.js"></script> and screenRes.js reads:

switch(screen.width) { case 640: goToPage('800.htm'); break; case 720: goToPage('800.htm'); break; case 800: goToPage('800.htm'); break; case 848: goToPage('800.htm'); break; case 1024: goToPage('1024.htm'); break; case 1152: goToPage('1024.htm'); break; case 1280: goToPage('1280.htm'); break; case 1600: goToPage('1600.htm'); break; default : goToPage('1600.htm'); break; }

so almost instantaneously you will be on http://tulsahightech.com/200905/800.htm, but your browser will say you are on http://tulsahightech.com/. And if you bookmark the site, and then come back in June with your browser set to 1600x1200, you will be sent to http://tulsahightech.com/200906/1600.htm, but your browser will still say you are on http://tulsahightech.com/.

That sounds good, but what about the reason I don't like frames, and that is they prevent people from being able to bookmark an article they like, or email a link to an article to smeone else. Remember, I am going to have my cake and eat it too, I will use frames just as they do what I want. And I will bail out the minute they work against me. The answer is "target="_top"". Normally I would have used

<li><a class="top" href="mayissue.htm">May Issue</a></li>

but that would have stayed in frames, and the browser would just have displayed "http://tulsahightech.com", but

<li><a class="top" href="mayissue.htm" target="_top">May Issue</a></li>

will display "http://tulsahightech.com/200905/mayissue.htm".

Having your cake and eating it too is nice.

But can I have a scoop of ice cream on mine? <grin>