| Handling Frames Without Tears |
First published in E-Book Compiler Newsletter
Frames are an HTML element for chopping up web (or e-book) pages into multiple, separately scrolling, regions. You might use frames to provide a common header or footer on many different web (or e-book) pages, provide a common menu across multiple pages, etc.
If you are not sure what I mean by frames, you can see an "exaggerated example" at this URL:
If you need a quick refresher on the HTML coding for frames, look at:
(this is kind of a quirky tutorial, but the examples are good)
If I had to name the "Top 10 Technical Questions About Creating E-Books", then frames would grab at least 2 of the top 10 places!
The power (and the pitfalls) of frames stems from how they are implemented in the HTML language. The way that frames work is you create one page which says how many frames and where they are placed (known as the "frameset"), and in this frameset page, you specify links to other pages (which are themselves just normal HTML pages) which are used as the content for each frame.
The power of frames is that:
Make no mistake about it, these are very powerful features. For example, the well-known e-book template package, Ebook Starter, uses both of these techniques to tremendous effect to (a) create e-books that look like real books, and (b) allow you to incorporate rotating banners in your e-book.
- You can design your pages to update individual frames separately, which can be very handy if you have something like a standard menu which you want to always be displayed next to your content.
- You can make the content of frames come from different sources. For example, in an e-book, one of your frames could contain an e-book page, and another could contain a page from your web site, the latter appearing to the user as an integral part of your e-book.
However, there are also some pitfalls with frames...
Pitfalls with using frames on a web site:
Pitfalls with using frames in an e-book:
- If you use frames on your web site it can cause problems with getting indexed with search engines. More specifically, some search engines are not good at indexing web sites that use frames, which can put a serious dent in your promotion efforts.
- Search engines tend not to be very good at differentiating between framesets and frame contents. This means if a user clicks a link to your site in a search engine, they might end-up on a page which just contains your web site's menu or page footer, rather than the whole frameset page.
- In e-books made with Activ E-Book Compiler, if the content of any frame can be a web site page, be sure to uncheck the option called "Automatically Open Internet Links in a new (browser) window" in Edit "User Interface".
This is just a quirk of the software :-)
- There is NO direct analogue to problem 3, for e-books. Activ E-Book Compiler's Search function will search both framesets and frame contents just fine. However, do remember it can only search using the information that you provide - so make sure your framesets have meaningful text in the content of the page (using the NOFRAMES tag is a good place as this text will never display in the e-book but it does help with making the e-book easier to search), or the Title/Description/Keywords in the Files tab.
- There IS a direct analogue of problems 4 and 5 for e-books, however you can work round these problems relatively easily if you are prepared to do some extra work.
If you don't do anything, you will find the Search, Table Of Contents, and Next/Previous options (in 4.2x) will step through both framesets and frame contents, which is unlikely to be the effect that you are aiming for!
What you need to do is use the Files tab (and most likely make some extra frameset pages) to give the compiler enough information to make sense of how you want the frames to be handled by Search, Table Of Contents and Next/Previous.
I've posted some fairly detailed instructions on how to do this at:
SHOULD I USE FRAMES AT ALL?
Once you've read all this, you might be asking yourself, should I use frames at all?
It's a fair question, it probably deserves a straight answer, but I think the best answer I can give is maybe not
For web sites: you want as many people as possible to see it, and you want these people to see it as YOU intended. So, the conclusion that I would draw from this, is that unless you have a very good reason why you absolutely must use frames, don't use them. Myself, I do occasionally use frames, but I try not to whenever possible.
For e-books: you can produce an e-book with "perfect" searching and navigation by using the solution I linked to under (viii), so it's a different kind of question. IF YOU DO EVERYTHING RIGHT, then frames will not stop your users seeing and navigating your e-book exactly as you intend. The question is simply, do you want to go to the extra trouble of "doing everything right"? Only you can answer that question!
ALTERNATIVES TO FRAMES?
The most obvious alternative to frames is to use tables to divide your pages up into sections. Because you can place tables inside tables, you can easily use this technique to divide your pages into menus, content area, headers, footers, etc. The areas won't scroll independently, but aside from that, you can achieve pretty much the same types of effects as using frames, but with less work and worries.
One reason that some people don't like to use tables, is they think that means they have to manually copy and paste the same menu, or header, or footer, HTML code to each page.
Actually, you don't!
Many of you will remember my previous article "Spaghetti HTML" in which I introduced a number of techniques to avoid manually copying and pasting code.
(Some readers subsequently emailed me to tell me that their particular HTML editor provides a global search and replace function, which makes things even easier for them!)
Another alternative to using frames is to use "iframes". Like frames, iframes create a separately scrolling area containing a "sub page", however there is an important difference: An iframe can be placed in a normal HTML page (you don't need to create a special frameset page).
If you want an example of an iframe, go here:
Iframes work with Internet Explorer 3 or later, and Netscape 6 or later, they also work in ALL environments where Activ E-Book Compiler works. Personally I would be extremely cautious about using iframes on a web site, but in an e-book they work just fine!
If you want to use an iframe in an e-book, simply do the following:
- If the content of an iframe can be a web site page, be sure to uncheck the option called "Automatically Open Internet Links in a new (browser) window" in Edit "User Interface".
- Use the Files tab to remove the Contents and Searchable attributes for the page which serves as the content of any iframe. This way, you can avoid these pages getting accidentally linked from the Search results or Table Of Contents.