Script Control frame (turn)

Source: Internet
Author: User
Script Control Frame

FRAME (frame) is one of our common techniques in Web page layout and typesetting. However, it is often not satisfactory, below we use the script to control frame, make it more perfect.
The script to protect frame
When we browse the Web, we often see that some of the Web page looks like a normal page, but it contains frames. These frames are very covert and they have no border. Even if you "save" the page, browsing offline will not find anything. In fact, you only save a "frame". At this time you just click on a few links to see if the address in the "Address bar" changes to know whether the frame is included. If not, you must be browsing in someone else's frame page, not on a separate page.
Here's a way to protect your frame.
<body onload=″if (parent.frames.length=0) top.location=′gotframe.htm′;″>
Just use the above statement instead of the HTML in the middle, and point the gotframe.htm to your frameset file (frame file). This script has the following purpose: If your page has a frame (take a leftpage and a right page for example). Add the above script to the left page and rigft page separately, even if someone uses browser enhancements such as Iepowertoy, and you don't want to open the left page and rigftpage in a separate window. You can only view your page through the entire frame.
Second, to avoid the frame is destroyed
First, add the following code to the <script language=″javascript″>
<!--settimeout (″changepage () ″, 0);
function Changepage ()
{
if (self.parent.frames.length!= 0)
Self.parent.location=″index.htm″; }
-->
</script>
On the Internet, you may encounter situations where someone is browsing through a page with frame frames, and just as your page is open in one of their frame pages, it is not a full-screen screen that is being browsed by others, which is not what you would like to see. The above script prevents one page from opening in the other frame. Simply change the index.htm to the file name of the page.
In addition, there is also a script for everyone. Add the following script to the <script language=″javascript″>
<!--if (self.parent.frames.length!= 0)
Self.parent.location=document.location.href;
-->

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.