Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Window-target meta tag work for busting frames?

Does adding the followin tag in the header section of a html document prevent the loading of the document within a frame? If so, why does anybody bother with Javascript methods?

<META HTTP-EQUIV="Window-target" CONTENT="_top" />
like image 440
Aheho Avatar asked Feb 20 '26 09:02

Aheho


2 Answers

Better use the BASE element instead:

<base target="_top">

But that does not prevent the document to be loaded inside a frame. It only will force all links to use the target _top as default target if not otherwise specified.

But if you want to prevent the document to be loaded inside a frame, try this JavaScript code:

if (top != self) {
    top.location.href = self.location.href;
}
like image 121
Gumbo Avatar answered Feb 22 '26 01:02

Gumbo


It seems that browsers don't support <META HTTP-EQUIV="Window-target" CONTENT="_top" /> meta tag anymore, they simply ignore it. So that's why people bother with using JavaScript, as Gumbo suggested.

like image 31
Dmitry Pashkevich Avatar answered Feb 22 '26 02:02

Dmitry Pashkevich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!