Target="_blank" not working

I have been using tripod free web hosting site for more than a year now.

Recently, they changed the codes in the banner creation.

All my hyperlinks with the code target=“_blank” do not open in a new browser window…instead, the same window is used…this is irritating…it means my having to use the back button everytime I want to goback to my webpage.

How is it they are able to override my code?

can you show us the page?

That doesn’t make much sense unless they have a script that disallows new pages being opened… this would make sure that their frame was always present.

Why don’t you post a link to your site so we can have a look at the code.

Off Topic:

You shouldn’t really be using the target attribute anyhow

Why not?

It’s been depracated.

The target attribute is really to target other frames, not spawn new windows. That’s a choice best left up to the user, and Javascript’s window.open() can also open new windows nicely.

What alternative is there other than Javascript? Isn’t opening a new window a pretty needed attribute (external links, etc).

I guess I’m replying to myself :stuck_out_tongue:

Here’s an XHTML alternative that I just came across:

Old code:

<a target="_blank" href="http://some_other_site.com">Some Other site</a>

XHTML Alternative:

<a onclick="window.open(this.href,'_blank');return false;" href="http://some_other_site.com">Some Other Site</a>

I think this article explains the proper way to do this with javascript and xhtml:

New-Window Links in a Standards-Compliant World

Even if it’s an external link, you shouldn’t open new windows if people don’t want them to be opened. If they want to stick around on your site they’ll right-click and choose to open it in a new window.

That’s the logic at least.

Always try to inform the user with text or a title attribute if you plan to spawn a window on an anchor element.

I think it is quite normal to have links to external websites open in a new window without a warning…!

Also, I have found that JavaScript that opens links in new windows are sometimes blocked by pop-up blockers…

Or use some kind of ‘new window’ mini icon.
It can be done easily enough using css to add padding and an offset background image for external links with either a specific class or within a certain container div.

I wouldn’t consider the title attribute to be enough on its own as most people don’t tend to linger on links long enough and don’t always read the info in the tooltip.

Similarly, most newbies aren’t even aware of the options available in right-click, so although they may actually prefer to have external links open in new windows, it can’t be relied upon that the user already knows how to get what they want from their browsing experience.

I feel the best option is to implement a javascript target switcher to allow users to choose whether external links open in new windows or not.
I adapted the ‘new windows in a compliant world’ method for use with the diary/events listings on my NPA site.

I set no target in the markup, but use js to set it to _blank by default.
The choice is clear, as is how to change it.

The switcher itself is also written into the page using js, so users without js aren’t presented with a switcher that doesn’t work.

Here’s the gubbins from my js file:


// - - - - - - - - - NEW WINDOWS

function extLinkOn() {
extLinks("_blank");
}

function extLinkOff() {
extLinks("_self");
}

function extLinks(targetVal) {
	if (!document.getElementsByTagName) return;
	var anchors =
		document.getElementById('events').getElementsByTagName("a"),
		aLength = anchors.length;
       for(var i=0; i < aLength; i++) {
		if (anchors&#91;i].href) {
			anchors&#91;i].target = targetVal;
		}
	}
}

window.onload = extLinkOn;

function checkTargets() {
(document.getElementById('targetbox').checked == true) ? extLinkOn() : extLinkOff() ;
}



function doLinkTarget() {
document.write("<form action=\\"\\"><div><input type=\\"checkbox\\" id=\\"targetbox\\" onclick=\\"checkTargets()\\" checked=\\"checked\\" />Open links in new Window</div></form>");
}

// - - - - - - - - - NEW WINDOWS

Placing the switcher in your markup:


<script type="text/javascript">doLinkTarget()</script>

msiruit, it’s typical for blockers to block popups triggered automatically (e.g. via onload, …), but I don’t know of any 3rd-party or native blockers that block popups triggered by manual user events such as onclick.

Does the blocker that you’re referring to block manually-triggered popups?

Yes, it a fairly interesting idea - assuming you are using text/html - you have to take for granted the user isn’t too slow to notice unclick the checkbox or set the UA to do otherwise.

you have to take for granted the user isn’t too slow to notice unclick the checkbox or set the UA to do otherwise
I don’t quite understand what you’re saying in that sentence. Please explain.

(I assumed that using <XHTML Strict 1.0 was a given as it’s unlikely that jakglass was going to leap straight from being a ‘Tripod-user’ to authentic xml delivery.) :wink:

Let’s take you example page some users might ignore the checkbox and scroll to or click upon one of those external links halfway before realising they have default ‘open in new window’ especially with it being a scrollable area.

If the user has a cognitive issue such as short memory span they may forget they scrolled down to have a peak at ‘link Z’ and the window spawned they might have a little surprise.

As humans we are designed to be energy efficient, in other words we are inertly lazy therefore basically I was saying its possible they don’t expect do such things - or miss the small print.

I’m sure that, no matter how well you think you have something covered, there’ll always be some kind of medical condition or other human shortcoming that will cause certain users to become confused by even the simplest facility.
Everything has a cut-off point.

I consider the switcher to be an excellent device as it offers a clear, usable option to everyone barring the completely stupid and those with some unmanagable medical condition.

You’re never going to please everyone all the time, so I don’t bother trying.
I make the site accessible and then set the defaults to favour the users that are most likely to yield a return for the site owner.

It is so interesting to see my question generating so many interesting views. Thanks guys. From the above message, I uninstalled and re-installed the Google Toolbar and the problem seems solved.

Just before uninstalling the Google Toolbar, I switched between allow/block pop-ups and noticed that sometimes my hyperlink would open into a new window and other times into the same frame.

I have re-installed the Google Toolbar and so far, the hyperlinks are working as they should.

Hey I really like that idea :slight_smile: