Old 01-07-2003, 08:39   #1 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
targets

problem: web based content management system will not allow you to specify a target for links - i need links to external sites to open in a new window.

the only way round that i can think of is to hard code the target into the nav for the local links specifying the links to be _parent and then set a base-href to be _blank so all links entered through the WCMS open in new windows. obviously this is baaaad bad practise so,...

any way of specifying targets through ID's? eg:

td #webContent { target:_parent }

now i now that's not gonna work but is there anything similar? i don't want to set a base target but would like all links within the 'content' area to open in new windows.

sorry if i'm not that clear in explaining. its a bas!*&d useless CMS they're using here.

ta.

brn.
  Reply With Quote
Old 01-07-2003, 13:08   #2 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,933
How many links will you need to address in the cms content?
I ask because it can easily be done with javascript, but, of course, using multiple instances of the same ID will invalidate your code.

It will still function. It just won't validate.

So obviously, it's preferable to be able to address the links by class name or some other valid <a> tag attribute.


If there are multiple links being produced on-page from the cms and you are unable to add any other attribute to them then you'll have to set the base target for the page and then use the javascript I mentioned to change the target for all your internal links.

Let me know what's what and I'll post the relevant code.
  Reply With Quote
Old 01-07-2003, 13:20   #3 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
i have access to the whole code. basic overview - split like includes - header, footer, then the content area sits between <td> at the end of the header and </td> at the start of the footer - the cms then allows content contiributors to throw in <p>'s and <h1>'s etc like the Active X control that hotmail uses if you're familiar with that.

i can add an ID to the opening <td> - just don't know how to tell the ID to open all links within the <td id="openlinks"> in a new window except for putting target="_blank" in the <a>

make sense?

the cms is full of links, its a kind of directory.
  Reply With Quote
Old 02-07-2003, 03:04   #4 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,933
I'm a little confused.

You say you have access to the whole code, but you dont have access to the <a> tag included in the cms.


I'm still checking into ways to address only those links that apear wihin a certain *ided) element, but I'm not sure it even can be done.


How many links are there outside the cms content <td>?

If there aren't that many, then you could add attributes to each of *them* that would allow you specify a certain target that would over-ride a <base target="_blank" /> in the header.

It's not the ideal situation, but it'll get the page functioning as you want until a more direct method can be found.
  Reply With Quote
Old 02-07-2003, 04:06   #5 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
i have access to the lot. but there's content editors who access only via a web based ActiveX interface - they can add links but i want them to be _blank which means i have to go in and edit their content after they've done it already - kinda screws the whole CMS reason for being ther in the first place.

the base target is the only way i can think of doing it at the moment but as you said, not really an ideal situation and i'd prefer (for now) to re-edit their content.

i'm hoping there's a way to, like you said, address links within a certain id, but i'm not sure its possible - thought i'd ask you guys.

i'm still working on it. i've got a week to launch, 4 hours till lunch.

cheers bill.
  Reply With Quote
Old 06-07-2003, 10:49   #6 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,933
[considering options]

How many links are there on the page besides the ones in the CMS content?
  Reply With Quote
Old 06-07-2003, 13:13   #7 (permalink)
TriPixels
A Hardcore Relaxer
 
TriPixels's Avatar
 
Join Date: May 2003
Location: Elizabethtown, KY, USA
Posts: 175
Send a message via AIM to TriPixels Send a message via MSN to TriPixels Send a message via Yahoo to TriPixels
YOu can always scrap your current CMS and script your own... In a way, that is what I'm doing, but I'm not going all out on the project... I'm just doing little things here, and little things there... :P
__________________
How much longer before you click on my link?
CLICK MY LINK
  Reply With Quote
Old 07-07-2003, 11:17   #8 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,933
external.js
Code:
function blankLinks( evt ) { var o = ( evt ) ? evt.target: event.srcElement; if ( o.nodeName != 'A' ) return; o.target = "_blank"; }

markup
Code:
<td onclick="blankLinks( event );"> ...cms content... </td>

I'd been discussing the problem with a copule of cohorts from SPf and though this is not the way I was primary thinking the problem would be solved, it's a sound method.

How it works:

Whenever the <td> (incl. its contents) are clicked, the script kicks in to assess whether the object that was clicked was an anchor tag <a>.

If it is then it immediately assigns target="_blank" to the tag and the link targets a new blank window.

If the clicked element isn't a tag, it does nada.


Hope that helps ya.


[edit]

Just tested and failed in Opera

[/edit]

'Plan B'?
  Reply With Quote
Old 07-07-2003, 11:57   #9 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
dude. i like the look of this.

most excellent. thanks for your time.



brn.
  Reply With Quote
Old 07-07-2003, 12:09   #10 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
failed in opera - but the links still work - its part of the way there. i'm gonna run it through my test bed tomorrow and i'll let you know the results.
  Reply With Quote
Old 07-07-2003, 14:19   #11 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,933
Having external links open internally isn't what I'd consider fatal, so you may choose to live with it failing for Opera users.
(It should be noted that Opera users are generally more savvy/discerning than average when it comes to browsing and are probably more inclined to have popups disabled. This means that a disproportionate percentage of them will not be able to access the new window target anyway.
Another consideration is that, being more savvy, they are probably better versed in using modifier keys to force links to open in new windows/tabs and would prefer to make the choice themselves.)


There are alternative methods, each with their own level of 'gracefullness'.

If you change your mind about the above script, let me know and I'll offer up one of the alternatives. One in particular is XHTML Strict compliant (i.e. no target attributes allowed) and degrades well for javascript 'differently-abled'* browsers).

*
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8