Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-12-02 00:32:22

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: [textile] target= _blank

All these JavaScript and jQuery solutions still effectively add the target=”_blank” attribute to your links – it’s the same as putting it directly in your links in the first place, but with the added (but admittedly negligible) overhead of the browser executing the JavaScript.

While your code may validate with the JavaScript/jQuery solution, this doesn’t mean anything – you’re still adding a deprecated attribute to your hyperlink tags – have a look at the generated source code using FireBug or Web Developer and you’ll see.

The only advantage of this method is not having to hack up Textpattern/Textile.

If you really want to stick to best practices or stick strictly to XHTML 1.0/1.1, don’t push any links into new windows at all – JS or no JS. Its also worth noting that XHTML 1.2 may well have allowed the target attribute (before XHTML 2’s death), and HTML5 doesn’t mind the target attribute.

My advice? Just use common sense – sometimes a _target=”_blank” isn’t such a bad thing.

Offline

#14 2011-01-21 02:05:29

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] target= _blank

keith wrote:

Have another look at what I linked to, Tommy – it doesn’t use “Target”, it uses the “Rel” attribute.

That said, your solution looks very neat and straightforward – can we have that in the core instead?

;0)

Incidentally, I wrote the post above 2 1/2 years ago – I think it’s safe to assume that the solution I linked to ain’t going into the core..!

Textile rel-attribute support is a feature-candidate for textile core and has been so for a while.

Here’s how to try this out…

  • Install a test copy of textpattern on a localhost site.
  • Download the feature-rel-attributes branch zip
  • Open the zip and over-write your textpattern installation’s classTextile.php with the one from the zip
  • Try out rel-attributes!

Examples…

Textile Output
"linktext(title){rel}":url <a href="url" title="title" rel="rel" >linktext</a>
"linktext(title){!}":url <a href="url" title="title" rel="nofollow" >linktext</a>
"!imageurl(alt text)!(title){rel}":linkurl <a href="linkurl" title="title" rel="rel"><img src="imageurl" /></a>
"(class#id)[en-gb]{text-transform:uppercase}Try this link(Link title){!}":http://textile.sitemonks.com <p><a href="http://textile.sitemonks.com" style="text-transform:uppercase;" class="class" lang="en-gb" id="id" title="Link title" rel="nofollow">Try this link</a></p>

I await feedback on the github issue tracker or in this thread please.


Steve

Offline

#15 2011-01-21 19:48:24

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: [textile] target= _blank

I’m very keen to test this Steve – but I’ve got a horrible feeling that there’ll eventually be a backwards compatability issue with the many pages I’ve already got on my live site that use the hack I mention up the page.

I need to get my head around that a bit… but thank you!


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#16 2011-01-21 20:16:05

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] target= _blank

keith wrote:

I’m very keen to test this Steve – but I’ve got a horrible feeling that there’ll eventually be a backwards compatability issue with the many pages I’ve already got on my live site that use the hack I mention up the page.

I need to get my head around that a bit… but thank you!

No problem Keith, do leave feedback on the thread I mentioned if you are worried about rel attributes. As it happens, it looks like the format used in that hack is the same as that of the candidate feature.


Steve

Offline

Board footer

Powered by FluxBB