Home >Web Front-end >JS Tutorial >js method to prevent the page from being called by iframe_javascript skills
The example in this article describes the js method to prevent the page from being called by iframe. Share it with everyone for your reference. The specific implementation method is as follows:
1. Problem description:
Sometimes we find that our website page is called by others and is exactly the same. This is actually a simple iframe call. Let me introduce to you a summary of js methods to prevent page iframe calls. Friends in need can refer to it.
2. Solution:
Prevent your webpage from being framed:
top.location.href The top address
windows.location.href own address
self refers to the current window object, which belongs to the top-level object of the window;
location.href refers to the URL address of a window object.
self.location.href refers to the URL address of the current window. If self is removed, it defaults to the URL address of the current window
I hope this article will be helpful to everyone’s JavaScript programming design.