The Javascript| Web page has two Web designers: those who prefer to use frames (frame) and those that dislike. People who don't like to use frames always complain that the framework makes the pages more complex, increases the burden of downloading, and reduces the chances that your pages will be found by search engines. Designers who like frames say the framework makes browsing easier and gives designers more control over how to schedule pages.
Whether you are in favor of using frames or objections, in fact, pages with frames always exist. In this article, we'll introduce you to two JavaScript programs that improve the frames page, which may give people who hate the framework a new look at the value of the framework.
Before we begin to introduce these two techniques, let's take a look at how the framework works. When you create a frames page, you build a special HTML page that contains two or more frames or different windows in a single page. The frames page defines the size of each frame and the HTML file name in which it is displayed.
One of the problems that Web designers often encounter is that the links that visitors or search engines build are often HTML pages in the frame, not the frames page itself. This makes it easy for people to get to one of your pages without any sign or browsing help-there is nothing to mark the site.
To resolve this link problem, open each of your pages in FrontPage and switch to the HTML page. Then insert the following code before the tag:
<script language= "JavaScript" >
<!--Hide from older browsers
if (window = top)
Top.location.href = "frames.htm";
-->
</script>
Replace the "frames.htm" with your frame page name in your code. "Now whenever you want to download this page directly, visitors will get the frames page."
Our second technique just takes the opposite approach, and it ensures that your page doesn't appear in someone else's frames page. Instead of opening a new window, some sites display external linked pages in a frames page.
To prevent your page from appearing in other people's frames, add the following JavaScript code before the markup in HTML:
<script language= "JavaScript" >
<!--Hide from older browsers
if (top.location!= location)
Top.location.href = Location.href;
-->
</script>
When the page is downloaded, the script automatically destroys the frame and displays itself in the window.
Note that the above script does not make your framework any different from others. Therefore, you should not insert it into all the pages that you have created and that you want to display in the frame. If you use frames, you should add this code snippet to the frames page itself. The completion method still switches to the HTML page and inserts the code before the tag.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service