ASP.NET Today: Frames and Grids
Another relatively common scenario for Web apps. You display a list of items to the user, the user can click to perform any action on the displayed items but also might want to request more information. To exemplify, imagine a shopping application with a grid of products and a Add to Cart button. Next, you need your users to get a preview of the product and more information that for space constraints couldn't show up in the grid row. How would you do that?
- Option #1: You add a link somewhere (say, More on this item) and open a popup window. If you hate popups, you can simply redirect the user to another new page. It works, but you risk to flood the user with too many (and perhaps undesired) browser windows.
- Option #2: You add a hyperlink column and an IFRAME tag into the page. You direct the output of the linked page to the target represented by the IFRAME.
To me, the latter option has a few advantages. First, you use distinct pages for the grid and information. Second, users see what they need without refreshing the whole page or opening a brand new one putting at risk the already limited screen real estate.
Using IFRAMEs (inline frames) is a debatable choice; but all considered if you like the result you actually get it's probably a good compromise between usability and portability. Read more here. I try to use IFRAME whenever possible. Some sparse considerations:
- IFRAME is no longer an IE-only feature and is part of the HTML 4.0 standard
- FireFox supports IFRAME just fine. I didn't try with Netscape 7.x, but someone told me it supports it too.
- If you incorporate IFRAME in your Web page, pay attention to close it explicitly with </iframe>. For some reasons, it cuts the remainder of the page if you don't close the tag or use the shortcut.
- Sure, IFRAMEs have a number of additional problems (i.e., printing, unreachable URL, dimensions) you need to deal with. Latest browsers seem to be able to stem the growth of security risks.
I also like the _search target, that is the IE and FireFox ability to open a page in the search panel, a window docked on the left edge of the browser's window. Functionally speaking, it's a good way to avoid IFRAMEs while serving users with new pages in the same screen.
NB: If you google for "_search target" you easily run into articles that report security bugs connected to the feature, especially for Mozilla FireFox. One that I've found dates back to mid April 2005. As I understand it, those security bugs relate to the browser rather than to using _search panes from within an ASP.NET page. Security risks are related to the fact that some malicious script can exploit the _search pane to follow links. Displaying a page that puts a read-only, nonclickable piece of HTML in the pane doesn't seem to be a security hazard to me. However, having users to apply the latest patch of their browser of choice is anyway a good thing.