Ticket #10376 (new enhancement)
Opened 8 months ago
Last modified 5 months ago
Opening a link in a new window?
| Reported by: | jennifer.johns@… | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | next-major-0.1X |
| Component: | wiki system | Version: | |
| Severity: | normal | Keywords: | bitesized |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
What code is necessary for me to create a link that will open in a new window, as opposed to opening within the existing window? I am including a link on a new webpage on gsa.gov that will take the customer away from the GSA site and onto a non-government site.
Attachments
Change History
comment:1 follow-up: ↓ 2 Changed 8 months ago by rblank
- Component changed from general to wiki system
- Keywords bitesized added
- Milestone set to next-major-0.1X
- Type changed from defect to enhancement
comment:2 in reply to: ↑ 1 ; follow-up: ↓ 3 Changed 5 months ago by rpg2424@…
Replying to rblank:
That's not really possible with a stock Trac. The usual way to do this is to add a target="_blank" attribute to the <a> tag of the link. But Trac is generating XHTML 1.0 Strict, and the target attribute doesn't exist in that DTD.
Change it and make it work please, hiding behind DTD is crippling the software.
comment:3 in reply to: ↑ 2 Changed 5 months ago by rblank
Replying to rpg2424@…:
Change it and make it work please, hiding behind DTD is crippling the software.
Thanks for the patch. Oh, wait, no patch to be found. Never mind…



That's not really possible with a stock Trac. The usual way to do this is to add a target="_blank" attribute to the <a> tag of the link. But Trac is generating XHTML 1.0 Strict, and the target attribute doesn't exist in that DTD.
You could write a small plugin with a macro that expands to a <a href="javascript:window.open(...)"> tag, or adds a new form of TracLinks for this purpose. Maybe there's even already one on trac-hacks.
Actually, this could even be a good addition to Trac core. For example, we could extend the [realm:resource] syntax, where a ^ prefix to the realm would mean "open in a new window" (e.g. [^wiki:WikiStart]). Or something more intuitive.