No target in <a> in XHTML 1.1?

N

nobody

Hey,

Is there a replacement for target in <a> in XHTML 1.1? Why would they get
rid of that? I couldn't find out anywhere. w3schools says it is allowed in
XHTML, but not a specific version. This is Strict by the way.

If there isn't, is my only option to use Javascript?

Regards
 
I

Isofarro

nobody said:
Is there a replacement for target in <a> in XHTML 1.1?

Add in the frameset module.
Why would they get
rid of that?

It only has meaning in frames and multiple windows scenarios - fairly
limited and does not work well within a Web context - which is the aim of
XHTML Basic.
 
L

Leif K-Brooks

nobody said:
Is there a replacement for target in <a> in XHTML 1.1? Why would they get
rid of that? I couldn't find out anywhere. w3schools says it is allowed in
XHTML, but not a specific version. This is Strict by the way.

If there isn't, is my only option to use Javascript?

Yes. CSS3 will have a replacment though, IIRC.
 
T

Toby A Inkster

nobody said:
Is there a replacement for target in <a> in XHTML 1.1? Why would they get
rid of that?

They got rid of it because they got rid of frames.

Frames will probably be back in a new guise (XFrames) in XHTML 2 or
possibly slightly later.
w3schools says it is allowed in
XHTML, but not a specific version. This is Strict by the way.

XHTML 1.0 Transitional
If there isn't, is my only option to use Javascript?

Or better still, to just leave it out.
 
B

bengee

nobody said:
Is there a replacement for target in <a> in XHTML 1.1? Why would they get
rid of that? I couldn't find out anywhere. w3schools says it is allowed in
XHTML, but not a specific version. This is Strict by the way.

If there isn't, is my only option to use Javascript?

I use <a href="#" onclick="document.location.href='somepage.htm';">click
here</a>

.... or use window.open() to open in a new browser window.

bengee
 
L

Leif K-Brooks

bengee said:
I use <a href="#" onclick="document.location.href='somepage.htm';">click
here</a>

Why in the world would you do that? All that does is make a link that
will only work with JavaScript enabled. Otherwise, it works *exactly*
the same as a normal link.
 
R

rf

nobody said:
allowed

I only need it to open the link in a new window. Bummer. Not everyone knows
you can choose where you wanna open a link (ie. like tab or new window).

Correct but those that do can make the choice. If *you* by default open the
link in a new window with target then you remove that choice. You are
intentionally restricting your viewer. You are also making it more difficult
to use your site for those who have popup stoppers installed.

Cheers
Richard.
 
L

Leif K-Brooks

rf said:
You are also making it more difficult to use your site for those who have popup stoppers installed.

I'm yet to see a popup stopper which blocks links with target="_blank".
 
R

rf

Leif K-Brooks said:
have popup stoppers installed.

I'm yet to see a popup stopper which blocks links with target="_blank".

The one I use, pop-up stopper from Panicware, stops *ALL* occurrances of new
windows regardless of where the new window originates.

It does not care how that window was launched, from a link with target or
even from me clicking on the browser icon on the launch bar. It will not
allow a second browser window to run, no exception [1].

[1] If I want to open a second browser window myself or if I actually wish
to allow a web page to open a new window for me then I have to lean on the
Ctrl key. Even right click->open link in a new window is blocked unless I
press Ctrl.

<details>
One of the things it does is to hook the window open API. It checks the
window class of the new window. If this is "IEFrame" (the window class used
by the IE wrapper) it looks for another window on the desktop with the same
window class. If it finds one then the current window open call is
dismissed, providing the Ctrl key is not currently down.

It also knows the window class of Mozilla and whichever other browser I care
to tell it about. I can't open an IE and then open a Mozilla without
pressing Ctrl.

This is windows programming at a level below the application level and
certainly below anything an author can say on a web page. Once the hook is
installed there is no way around it, and most certainly none from a web page
authoring standpoint :)
</details>

Cheers
Richard.
 
I

Isofarro

bengee said:
I use <a href="#" onclick="document.location.href='somepage.htm';">click
here</a>

<a href="somepage.htm">Some page</a> is a far better solution - does all of
the above without the accessibility problem of requiring javascript to be
enabled.
 
D

David Dorward

Leif said:
I'm yet to see a popup stopper which blocks links with target="_blank".

Mozilla has it built in, although it hasn't made its way in to the
preferences yet (i.e. you have to exit your prefs file by hand)
 
L

Leif K-Brooks

rf said:
The one I use, pop-up stopper from Panicware, stops *ALL* occurrances of new
windows regardless of where the new window originates.

It does not care how that window was launched, from a link with target or
even from me clicking on the browser icon on the launch bar. It will not
allow a second browser window to run, no exception.

Then I would argue that your popup stopper is broken.
 
B

bengee

Leif said:
Why in the world would you do that? All that does is make a link that
will only work with JavaScript enabled. Otherwise, it works *exactly*
the same as a normal link.

Duh. Yes you're right. Whaat i meant to say was that if i want another
window to open, i use window.open. Don't know why i said
document.location.href!!! True also that Javascript is needed for
window.open. What are others doing??

bengee
 
K

Kris

Why in the world would you do that? All that does is make a link that
will only work with JavaScript enabled. Otherwise, it works *exactly*
the same as a normal link.

Duh. Yes you're right. Whaat i meant to say was that if i want another
window to open, i use window.open. Don't know why i said
document.location.href!!! True also that Javascript is needed for
window.open. What are others doing??[/QUOTE]

I'm doing this: I indicate with external links that they are indeed
external, to avoid confusion for the user that he has 'moved to another
site'. They can decide for themselves to open in new windows.
 
L

Leif K-Brooks

bengee wrote:

Duh. Yes you're right. Whaat i meant to say was that if i want another
window to open, i use window.open. Don't know why i said
document.location.href!!! True also that Javascript is needed for
window.open. What are others doing??

If you really need to open links in new windows, do something like:

<a href="foo.html" onclick="window.open(...foo.html...)">link text</a>

That way, people without JavaScript (or JavaScript disabled) will have a
normal link.
 
O

Owen Jacobson

David said:
Mozilla has it built in, although it hasn't made its way in to the
preferences yet (i.e. you have to exit your prefs file by hand)

As the mozilla preferences file is somewhat poorly documented, would
you mind cluing me in as to which pref I should be editing?
 
D

DU

Leif said:
I'm yet to see a popup stopper which blocks links with target="_blank".


In the user.js file of any browser based on Mozilla 1.3+:

user_pref("browser.block.target_new_window", true);

DU
 
D

DU

David said:
Mozilla has it built in, although it hasn't made its way in to the
preferences yet (i.e. you have to exit your prefs file by hand)


It was in NS 7.0x in the advanced prefs (not sure about Mozilla though).

http://www10.brinkster.com/doctorunclear/GRAPHICS/PNG/OpenLinkInNewWindowSetting.png

The editing of the user.js file was possible for a long time... not sure
when it started.

!!
// Override popping up new windows on target=anything.
// This is now accessible in the prefs dialog, under
Advanced|Scripts&Windows.
user_pref("browser.block.target_new_window", true);
!!
coming from
http://www.mozilla.org/unix/customizing.html#prefs
which is an old file.

Also, Opera 7.23 neutralize links with target="_blank" via the
contextmenu right-click.

DU
 
D

DU

Leif said:
bengee wrote:




If you really need to open links in new windows, do something like:

<a href="foo.html" onclick="window.open(...foo.html...)">link text</a>

You need to cancel the default action of the link with return false;
that's quite important to do. Adding an icon and a title attribute to
indicate that the link will open a new window is also recommendable.
There is a lot of code customization to do here if you want to your
link, new window to be hassle-free for both newbies and power-users.

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top