9.6. How do I make sure my framed documents are displayed inside their frameset? When the sub-documents of a frameset state are accessed directly, they appear without the context of the surrounding frameset.
If the reader\'s browser has JavaScript support enabled, the following script will restore the frameset:
<SCRIPT TYPE=\"text/javascript\"> <!-- if (parent.location.href == self.location.href) { if (window.location.replace) window.location.replace(\'frameset.html\'); else // causes problems with back button, but works window.location.href = \'frameset.html\'; } // --> </SCRIPT> A more universal approach is a \"restore frames\" link:
Note that in either case, you must have a separate frameset document for every content document. If you link to the default frameset document, then your reader will get the default content document, rather than the content document he/she was trying to access. These frameset documents should be generated automatically, to avoid the tedium and inaccuracy of creating them by hand.
Note that you can work around the problem with bookmarking frameset states by linking to these separate frameset documents using TARGET=\"_top\", rather than linking to the individual content documents.
9.7. Is there a way to prevent getting framed? \"Getting framed\" refers to having your documents displayed within someone else\'s frameset without your permission. This can happen accidentally (the frameset author forgot to use TARGET=\"_top\" when linking to your document) or intentionally (the frameset author wanted to display your content with his/her own navigation or banner frames).
To avoid \"framing\" other people\'s documents, you must add TARGET=\"_top\" to all links that lead to documents outside your intended scope.
Unfortunately, there is no reliable way to specify that a particular document should be displayed in the full browser window, rather than in the current frame. If you can configure your server to send the proprietary header Window-Target: _top in the HTTP response, then Netscape browsers will display your document in the full browser window. However, other browsers ignore this header, and it doesn\'t work to use <META HTTP-EQUIV=\"Window-target\" CONTENT=\"_top\"> in the document itself to mimic the HTTP response.
Another workaround is to use <BASE TARGET=\"_top\"> in the document, but this only specifies the default target frame for links in the current document, not for the document itself.
If the reader\'s browser has JavaScript enabled, the following script will automatically remove any existing framesets:
<SCRIPT TYPE=\"text/javascript\"> <!-- if (top.frames.length!=0) top.location=self.document.location; // --> </SCRIPT> An alternative script is
<SCRIPT TYPE=\"text/javascript\"> <!-- function breakOut() { if (self != top) window.open(\"my URL\",\"_top\",\"\"); } // --> </SCRIPT> </HEAD> <BODY onLoad=\"breakOut()\">
Du kan godt dele point mellem flere svar en anden gang... du markerer bare begge navne og trykker accepter ;o)
Men tak...
- Anders
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.