Home > Article > Web Front-end > JavaScript implements code sharing to prevent web pages from being embedded in Frame_javascript skills
Recently, another rogue behavior has become popular in China: using frames to embed your web pages into other web pages.
For example, there is a website that claims to be a "word-of-mouth aggregation portal" that provides the best content from various online forums across the country. However, in fact, it uses a frame to crawl other people's web pages, and then adds its own advertisements and website logos on it. How is this different from a pirated bookseller? !
Prevention method, in
Add this code before
:
This code is valid. However, there is a problem: after using it, no one can embed your web page into the frame, including yourself.
Is there a way so that my webpage can only be embedded in my own frame, not someone else's frame?
Okay, the upgraded version of the code is completed. Except for local domain names, other domain names cannot embed your web page in the frame. My blog now uses this code.