On 1/4/06, Patrick Barnes nman64@n-man.com wrote:
Arthur Pemberton wrote:
Great. One problem I have not yet found a solution to however is the handling of the TARGET attribute (not supported in XHTML). Altough I am some time away from coming to this problem. Any suggestions on how to handle that?
You have three choices, and I'll leave the choice up to you.
- Extend the DTD to include the target attribute.
This will allow the document to validate, but really is cheating.
- Use JavaScript with PrivoxyWindowOpen().
Works well, but can cause problems with the passing of the referring URL or with old browsers.
- Use JavaScript and the rel attribute to set the DOM target attribute.
This JavaScript (probably in a separate .js file):
|function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank"; } } window.onload = externalLinks;
This script tag:
<script type="text/javascript" src="filename.js"> </script>
| And anchors that look like this: <a href="http://target.uri.here/" rel="external">A Link to open in a new window</a>
This solution is probably the one I would use. It works well throughout the browser world (ancient browsers will open the links in the same window), and it complies with standards without cheating.
I hadn't come across 3 before. I like it the best.
--
Fedora-websites-list mailing list Fedora-websites-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-websites-list
-- As a boy I jumped through Windows, as a man I play with Penguins.