473,698 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening Links in a new window. What's the "right" way?

Hello all,

On occasion I want to open hyperlinks (images, etc.) in a new window. In the
past, I've used target="_blank" to open the link in a new window. However,
using the "target" attribute causes my pages to fail validation (strict
doctype). The validator says "There is no attribute 'target'.."

So...how do I open a link in a new window, without Javscript, and pass
strict validation?

--
Viken K.
http://home.comcast.net/~vikenk
Dec 30 '05 #1
44 9435
"Viken Karaguesian" <vi****@NOSPAMc omcast.net> wrote:
On occasion I want to open hyperlinks (images, etc.) in a new window.
Stop wanting that. Problem solved.
the past, I've used target="_blank" to open the link in a new window.
However, using the "target" attribute causes my pages to fail validation
(strict doctype). The validator says "There is no attribute 'target'.."
Of course. It's simple as 2 + 2 = 4. (Actually, simpler; no arithmetics is
involved, it's pure syntax.)
So...how do I open a link in a new window, without Javscript, and pass
strict validation?


You don't.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Dec 30 '05 #2
You have to use javascript to do it the proper way now.

<a href="link.html " onclick="window .open(this.href );return
false;">link</a>

this is the proper way to handle it.

Dec 30 '05 #3
"Viken Karaguesian" <vi****@NOSPAMc omcast.net> wrote:
On occasion I want to open hyperlinks (images, etc.) in a new window.


You've not specified what browser you are using, some methods for
popular browsers:

IE: Right click -> Open in new window
Opera: Click link with middle mouse button (or wheel)
FF: Click link with middle mouse button (or wheel)

--
Spartanicus
Dec 30 '05 #4
"Viken Karaguesian" <vi****@NOSPAMc omcast.net> writes:
On occasion I want to open hyperlinks (images, etc.) in a new window.


That's very simple. You just right-click on the hyperlink and select
"Open in new window" or "Open in new tab".

What I don't know how to do is force a hyperlink to open in the current
window/tab despite the attribute target="_blank" . I hope that style
falls out of fashion, or at least that browsers will provide an obvious
way for users to disable it.
Dec 30 '05 #5
>>On occasion I want to open hyperlinks (images, etc.) in a new window.

You've not specified what browser you are using, some methods for
popular browsers:

IE: Right click -> Open in new window
Opera: Click link with middle mouse button (or wheel)
FF: Click link with middle mouse button (or wheel)

Thanks for replying everyone. Although, now that I received your replies, I
realize that my question was a bit vague. I know how to right click and
"open in new window" :>)

What I meant was: How do I use HTML to force a link to open in a new window
if target="_blank" is invalid? From the responses I got, my suspicions
were validated: there's no way to do it without using JavaScript.

Sometimes, some links just don't fall into the "flow" of a site (sample
images, for instance) and I'd rather open those up in a small window than to
have someone navigate away from the site.
--
Viken K.
http://home.comcast.net/~vikenk
Dec 30 '05 #6
bruno wrote:
You have to use javascript to do it the proper way now.
<a href="link.html " onclick="window .open(this.href );return
false;">link</a>


Don't do that. If you insist of forcing new windows on people, then use a
Transitional Doctype and the target attribute - that way at least people
can filter it out easily.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Dec 30 '05 #7
In article <ZN************ *************** ***@comcast.com >,
Viken Karaguesian <vi****@NOSPAMc omcast.net> wrote:
On occasion I want to open hyperlinks (images, etc.) in a new window.
You've not specified what browser you are using, some methods for
popular browsers:

IE: Right click -> Open in new window
Opera: Click link with middle mouse button (or wheel)
FF: Click link with middle mouse button (or wheel)

Thanks for replying everyone. Although, now that I received your replies, I
realize that my question was a bit vague. I know how to right click and
"open in new window" :>)

What I meant was: How do I use HTML to force a link to open in a new window
if target="_blank" is invalid? From the responses I got, my suspicions
were validated: there's no way to do it without using JavaScript.


We all realized that, of course.
Sometimes, some links just don't fall into the "flow" of a site (sample
images, for instance) and I'd rather open those up in a small window than to
have someone navigate away from the site.


Is is likely to be clear to readers that this is so?
If so, then readers can choose to open the link in a
new tab or window themselves.

--
= Eric Bustad, Norwegian Bachelor Programmer
Dec 30 '05 #8
Viken Karaguesian <vi****@NOSPAMc omcast.net> wrote:
Sometimes, some links just don't fall into the "flow" of a site (sample
images, for instance) and I'd rather open those up in a small window than to
have someone navigate away from the site.

Eric Kenneth Bustad <ek******@monmo uth.com> wrote: Is is likely to be clear to readers that this is so?
If so, then readers can choose to open the link in a
new tab or window themselves.


Of course, many attempts by authors to open new windows interfere with the
users' ability to open new windows normally. Shift-click no longer opens
the link in a new window, and may not open the link at all. The only way to
open the link in a new window is to try to open it normally.
--
Darin McGrew, mc****@stanford alumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp. com, http://www.HTMLHelp.com/

"Experience is what allows you to recognize a mistake when you make it again."
Dec 30 '05 #9
Bruce Lewis wrote:
What I don't know how to do is force a hyperlink to open in the current
window/tab despite the attribute target="_blank" . I hope that style
falls out of fashion, or at least that browsers will provide an obvious
way for users to disable it.


You have that option in Firefox. Enter
about:config in the Location Bar. Select
browser.block.t arget_new_windo w and change value
from false to true. Now you have the power!
Nothing opens in a new window unless you choose it
yourself.
--
Inger Helene Falch-Jacobsen
http://home.no.net/ingernet/
Dec 30 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1838
by: Paul Miller | last post by:
I came across this recipe on the Python Cookbook site: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286134 As written, it allows evaluation of either constants or more general expressions involving constants and operators (but not function calls). I haven't thoroughly tested it for security, but it at least passes the smoke test. Assuming that this can either be demonstrated to be
3
1641
by: Evgeny Gopengauz | last post by:
What is the way recommended by Microsoft for distributing the MSSQL database with end-user application if I don't like to use sql-scripts because I need to hide the stored procedures sources (they are marked as "encrypted")? Backup/restore? Or something else? *** Sent via Developersdex http://www.developersdex.com ***
4
1913
by: lionheart | last post by:
Hi, I am currently trying to group my classes using namespaces. But since these groups are not really independend I end up to have a lot of forward declarations. My first approache was to enclose all class definitions and forward declarations in the corresponding headers directly. Which turned out to make it difficult to read the header, and created a lot of overhead. Therefore at the moment I am using a headerfile dedicated to forward
0
8668
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9012
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7708
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3034
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.