BBCode for URLs not calling _blank ever - I did read the JS solution threads BBCode for URLs not calling _blank ever - I did read the JS solution threads
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

BBCode for URLs not calling _blank ever - I did read the JS solution threads

Started by Aeronautic, May 21, 2006, 11:41:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Aeronautic

I've searched on the board for this and read the solution for the gallery credit addressed with that nifty javascript solution, but I did not find an answer as to why bbcode for url calls in file descriptions are calling links as "self" (in effect) instead of "_blank" style (in effect).

I'm building a gallery with 1.4 at this url:

http://www.aeronauticpictures.com/royalty-free-stock-footage/index.php

It uses QuickTime files with matching thumbs. I've got it playing a short QT file as a brief preview but want to link to a full length QT file that I'd like to open in a stand alone player from the description text linked with the url code as shown on that page.

Using the code below, it simply links to an embedded player in whatever browser the user operates.

I've also got a call to a stand alone purchase page (html) until I test the paypal mod. That too I'd like to open in a new window - leaving my customer on the product page.

Here is the exact code from the description field:

[b]Exploring the history of aviation from 1900 to the 1930s[/b]
[color=red][b][u]Please Allow Time[/u] For The Preview To Load Above
You Will See A QuickTime Preview Of [u]One Clip[/u] From This Disc[/b][/color]
[color=red][b]
( BUY NOW ) [url=http://www.aeronauticpictures.com/royalty-free-stock-footage/royalty-free-stock-footage.purchase.aviation.early-flight.htm]Click Here To Buy This Early Flight Royalty Free Stock Footage Disc[/url][/b][/color]
[color=#FF9900][b]
To View The Entire Preview Video Of All Clips On The Early Flight Royalty Free Stock Footage Disc - [u]27 Megs - Expect To Wait For The Download[/u] [url=http://www.aeronauticpictures.com/movs/royalty-free-stock-footage.early-flight.preview.full.mov]Click Here[/url][/b][/color]


The issue I've got with (I think) with the javascript solution is that it would change all domain based links to external calls if this portion were set thus:

if (anchor.getAttribute("href") == "http://www.aeronauticpictures.com/")
     anchor.target = "_blank";


Or could I set this to both, say, a /mov/ url for the long form previews and another path for purchase pages like /buy/ ?

Many thanks!

Nibbler

Use the same javascript solution for the bbcode urls as for the gallery footer.

Aeronautic

Quote from: Nibbler on May 22, 2006, 10:14:41 AM
Use the same javascript solution for the bbcode urls as for the gallery footer.

Nibbler,

Thanks for the reply - I take it you are saying use the code which includes this snippet (but use the whole thing, of course):

if (anchor.getAttribute("href") == "http://www.aeronauticpictures.com/")
     anchor.target = "_blank";


???

I'm no javascript guru, so since we don't want all calls of urls on the aeronauticpictures.com domain to open new windows, just those that call the long QT movies and purchase pages, do I need to implement two calls to the anchor.getAttribute ?

The movies are living in the /movs path from the site root (not gallery) and the purchase pages in the /royaltyfree-stock-footage path (close but not identical to the gallery) from the site root (also not gallery)

Since normal gallery navigation is not via BBCode, can I assume that implementing this solution will not open all normal CPG navigation links in new windows?

Sorry for being such a coding newb - I just don't know the syntax for pulling this off in javascript.

Thank you again!

Aeronautic

Solved I think - Dev Team - is there a reason I should not be doing this?

line 586 in include/functions.inc.php

this:

$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" rel="external">

to this:

$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" rel="external" target="_blank">


???

Seems to be working as wished in my royalty free stock footage store:

http://www.aeronauticpictures.com/royalty-free-stock-footage/index.php

Joachim Müller

There is no security issue, but the target attribute is being considered to be obsolete. The recommended method is to do as suggested in http://www.sitepoint.com/article/standards-compliant-world

Aeronautic

Thanks for the reply and advice GauGau.

I hope to install the paypal hack mod to replace one of these _blank calls (the purchase page), and I'll address the long form .mov previews with the standards compliant approach after that's operational.

Thanks again.