views:

79

answers:

1

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" />
+1  A: 

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;
}
Gumbo
So if I understand you correctly,the window-target doesn't apply to the current page, but is applied to the link within the current page. Is that correct?
Aheho
@Aheho: To be honest, I’ve never heard of such an HTTP equivalent header field.
Gumbo