| ★ wanayoo — archive 1999 http://webdeveloper.com/drweb/96Nov18-drwebsite.html | Nouvelle recherche | Portail wanayoo |
DR. WEBSITE
[an error occurred while processing this directive]How to Find URLs Of Framed Documents
Dear Dr. Website®: When I visit a frame-enabled page, is there an easy way to determine the URL of the individual documents within each of the frames? The URL block in the browser never changes.
The individual source documents that display within each frame of a frame-enabled page have unique URLs, just like regular HTML documents. With Navigator 3.0, for example, you can see the full pathname display in the location bar if you click (or right-click, for Windows users) on a frame and choose an option to display the frame in a new window. If your browser doesn't support this option and you start following links within frames, though, it takes a little more effort to determine the URL of the source document you want. Let's start with determining the URLs of the source documents that make up a framed document that you see upon entering. If you look at the code upon visiting a framed page, you'll see that each <FRAME> tag identifies a source document using the SRC attribute. These are often listed with relative pathnames--just a document name instead of the full URL. You should be able to use the main document's URL as a baseline for figuring out the URL of a source document within a frame on that page. For example, if your main document is www.someplace.com/frames/index2.html, and the source code includes a frame tag reading <FRAME SRC="/old?u=http%3A%2F%2Fwebdeveloper.com%2Fdrweb%2Fcontents.html&y=1999">, you can view that frame's source document alone at www.someplace.com/frames/contents.html. Once you start following links within frames, though, viewing the document's source doesn't help you see the contents of refreshed frames. And as you've discovered, loading a new document into a frame won't cause its URL to display in your browser's location window either. One easy way to get around this and discover the URL of a given source document is to look at the source code for the hyperlink that caused the new document to load. The HREF attribute in that link's anchor tag will give you the pathname you're looking for. To do this, you may have to look at the source code for an individual frame, if that's where the anchor link is embedded. If you're using Navigator 3.0 or Internet Explorer, it's easy to view the source for a single frame. Navigator has a menu item for viewing the source of individual frames once you've clicked on them. With Internet Explorer 3.0, you can right-click on the frame and choose an option for viewing its source. Look at the URL in the <A HREF> tag that led to displaying a new source document; that will give you the information you need to identify the document's full URL. What if you're using a browser that doesn't offer a feature for viewing source code for an individual frame? You can still get there by viewing the main document's source, looking up the name of the document for the referring frame, then loading that document and viewing the code.
MIRROR, MIRROR, ON THE SITE
Dear Dr. Website®: I want to host a backup or a mirror of a Web site. How do I set up our site to contain a mirror of another site?
There are a couple of ways you can create a mirror, or a copy of another site's documents. Before you proceed, you should first obtain permission from the remote site's Web administrator to do so. One easy way to mirror a site is by invoking a Perl script that mirrors a whole directory tree. For example, w3mir is an alpha version of a mirroring package for documents using the HTTP protocol; to mirror an FTP site, look into a Perl script called mirror. In order to keep your local mirrored site up to date, though, you'll have to check the original site on a regular basis to copy new and revised files. Another approach uses real-time, Web-based mirroring, which makes use of a proxy server and URL remapping. You can read Janne Sinkkonen's WWW-based mirroring of HTML documents, written for the online journal Web Tools Review, which describes this procedure.
Please send your site design and development questions to drweb@internet.com, or visit the Ask Dr. Website page.
Reprinted from Web Week, Volume 2, Issue 18, November 18, 1996 © internet.com Corporation All rights 18reserved. Keywords: HTML Date: 19961118