Hi!
I know how to code a link.
But can you code that link to open in a new browser tab?
Or a new browser window?
On 10/19/2021 8:40 PM, Dale wrote:
Hi!
I know how to code a link.
But can you code that link to open in a new browser tab?
Or a new browser window?
did a web search and found this ...
https://www.w3docs.com/snippets/html/open-hyperlink-in-a-new-window.html
for a new window ...
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
can't quite see the new tab
nothing will affect whether a new tab is behind or in front
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
On 10/19/21 6:53 PM, Dale wrote:
<p>This <a href="https://www.w3docs.com/"
target="_blank">hyperlink</a> will open in a new tab. </p>
My experience with this years ago surprised me somewhat.
Don't think of it as a "new tab" so much as a "named tab". Meaning that
the link gets opened in the tab with the name of the target. That tab
will be new if it doesn't already exist. If it does already exist, it
will be the existing window.
With this in mind, I took to having links open in different targets:
<a href="https://www.w3docs.com/" target="w3docs">w3docs</a>
<a href="https://www.wikipedia.com/" target="wikipedia">Wikipedia</a>
The value of the name can be random if you want. But the different
links should use different target values if you want different tabs for
them.
At least that's how I remember things being 10+ years ago.
On 10/19/2021 5:53 PM, Dale wrote:
On 10/19/2021 8:40 PM, Dale wrote:
Hi!
I know how to code a link.
But can you code that link to open in a new browser tab?
Or a new browser window?
did a web search and found this ...
https://www.w3docs.com/snippets/html/open-hyperlink-in-a-new-window.html
for a new window ...
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
can't quite see the new tab
Whether the new page opens in a new tab or new window is a function of
the user's setting for their browser. Also, if the user's browser
setting is to open a new tab, whether that tab remains behind the prior
tab or is in front of it is a function of another user's setting.
Nothing you do in the HTML will affect whether the user gets a new
window or a new tab, and nothing will affect whether a new tab is behind
or in front of the prior tab.
On 10/19/2021 5:53 PM, Dale wrote:
On 10/19/2021 8:40 PM, Dale wrote:
Hi!
I know how to code a link.
But can you code that link to open in a new browser tab?
Or a new browser window?
did a web search and found this ...
https://www.w3docs.com/snippets/html/open-hyperlink-in-a-new-window.html
for a new window ...
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
can't quite see the new tab
Whether the new page opens in a new tab or new window is a function of
the user's setting for their browser. Also, if the user's browser
setting is to open a new tab, whether that tab remains behind the prior
tab or is in front of it is a function of another user's setting.
Nothing you do in the HTML will affect whether the user gets a new
window or a new tab, and nothing will affect whether a new tab is behind
or in front of the prior tab.
On 10/19/21 6:53 PM, Dale wrote:
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
My experience with this years ago surprised me somewhat.
Don't think of it as a "new tab" so much as a "named tab". Meaning that
the link gets opened in the tab with the name of the target. That tab
will be new if it doesn't already exist. If it does already exist, it
will be the existing window.
With this in mind, I took to having links open in different targets:
<a href="https://www.w3docs.com/" target="w3docs">w3docs</a>
<a href="https://www.wikipedia.com/" target="wikipedia">Wikipedia</a>
The value of the name can be random if you want. But the different
links should use different target values if you want different tabs for
them.
At least that's how I remember things being 10+ years ago.
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
David E. Ross:
On 10/19/2021 5:53 PM, Dale wrote:
On 10/19/2021 8:40 PM, Dale wrote:
Hi!
I know how to code a link.
But can you code that link to open in a new browser tab?
Or a new browser window?
did a web search and found this ...
https://www.w3docs.com/snippets/html/open-hyperlink-in-a-new-window.html >>>
for a new window ...
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
can't quite see the new tab
Whether the new page opens in a new tab or new window is a function of
the user's setting for their browser. Also, if the user's browser
setting is to open a new tab, whether that tab remains behind the prior
tab or is in front of it is a function of another user's setting.
Nothing you do in the HTML will affect whether the user gets a new
window or a new tab, and nothing will affect whether a new tab is behind
or in front of the prior tab.
Wrong - target="_blank" will always open a link a a new tab or window
and the user can not prevent this.
Therefore I generally recommend against this! I user can always decide
to open a link in a new tab if he wants to - but if target="_blank" is present a user can NOT force the browser to open the link in the current tab/window. Mostly this is only done for SEO to keep the current web
site open even if you link to another site.
In message <sknpai$ffl$1@dont-email.me> Dale <dale@dalekelly.org> wrote:
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
No, the behavior of that is entirely up to the browser (and usually the user's preferences). It opens a new WINDOW, which the Browser may decide
to open as a tab, or not.
It is also possible to attempt to open a new window using JavaScript, but most browsers block this as abusive behavior (again, depending on user preferences, but blocking so-called pop-ups is often the default
behavior).
In message <sknpai$ffl$1@dont-email.me> Dale <dale@dalekelly.org> wrote:
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
No, the behavior of that is entirely up to the browser (and usually the user's preferences). It opens a new WINDOW, which the Browser may decide
to open as a tab, or not.
On 10/20/2021 7:13 AM, Arno Welzel wrote:[...]
Wrong - target="_blank" will always open a link a a new tab or window
and the user can not prevent this.
Therefore I generally recommend against this! I user can always decide
to open a link in a new tab if he wants to - but if target="_blank" is
present a user can NOT force the browser to open the link in the current
tab/window. Mostly this is only done for SEO to keep the current web
site open even if you link to another site.
No, you do not understand. The markup target="_blank" will open a new
page without closing the page containing that markup. Whether that new
page is in a new tab or a new window is controlled by the user's
browser, not by the markup.
In the version of SeaMonkey that I use, there are three separate sets of options:[...]
NOTE WELL: I control where the new Web page appears. The parent Web
On 10/19/21 6:53 PM, Dale wrote:
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
My experience with this years ago surprised me somewhat.
Don't think of it as a "new tab" so much as a "named tab". Meaning that
the link gets opened in the tab with the name of the target.
That tab will be new if it doesn't already exist. If it does already
exist, it will be the existing window.
At least that's how I remember things being 10+ years ago.
It is also possible to attempt to open a new window using JavaScript, but most browsers block this as abusive behavior (again, depending on user preferences, but blocking so-called pop-ups is often the default
behavior).
Lewis wrote:
It is also possible to attempt to open a new window using JavaScript, but
most browsers block this as abusive behavior (again, depending on user
preferences, but blocking so-called pop-ups is often the default
behavior).
The default behavior is often to block popups *that the user did not cause consciously*, different from what you describe in the first sentence:
*those* popups are NOT blocked by default.
A proper way to do this would be
<a href='foo' target='bar'
onclick='return !window.open(this.href, this.target, "width=200,height=200")'
>…</a>
document.addEventListener('load', function () {
document.links['link-foo'].addEventListener(
'click',
function (e) {
if (my.open(
e.target || e.srcElement,
{width: 200, height: 200}))
{
e.preventDefault();
return false;
}
},
false);
});
Lewis:
In message <sknpai$ffl$1@dont-email.me> Dale <dale@dalekelly.org> wrote:
<p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a>
will open in a new tab. </p>
No, the behavior of that is entirely up to the browser (and usually the
user's preferences). It opens a new WINDOW, which the Browser may decide
to open as a tab, or not.
Yes - but the browser WILL ALWAYS open something new! A user CAN NOT
prevent this if target="_blank" is present.
Therefore I recommend NOT to do this on a regular basis but only for
very special cases where the user will understand *why* a new tab or
window will open when clicking the link.
In message <itdaphFt4v8U2@mid.individual.net> Arno Welzel <usenet@arnowelzel.de> wrote:
Lewis:
In message <sknpai$ffl$1@dont-email.me> Dale <dale@dalekelly.org> wrote: >>>> <p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a> >>>> will open in a new tab. </p>
No, the behavior of that is entirely up to the browser (and usually the
user's preferences). It opens a new WINDOW, which the Browser may decide >>> to open as a tab, or not.
Yes - but the browser WILL ALWAYS open something new! A user CAN NOT
prevent this if target="_blank" is present.
It certainly is possible, though I don't know if any current browsers
support that user option. But yes, there is nothing preventing a browser
for having an option "Do not allow clicks to open a new window."
Therefore I recommend NOT to do this on a regular basis but only for
very special cases where the user will understand *why* a new tab or
window will open when clicking the link.
Opening new windows for users is a speedy way to piss them off, and
using pop-=up windows is a sure way to lose users and have them never
return to your site.
In message <itdaphFt4v8U2@mid.individual.net> Arno Welzel<usenet@arnowelzel.de> wrote:
Yes - but the browser WILL ALWAYS open something new! A user CAN NOT prevent this if target="_blank" is present.
It certainly is possible, though I don't know if any current browsers
support that user option. But yes, there is nothing preventing a browser
for having an option "Do not allow clicks to open a new window."
In message <itdaphFt4v8U2@mid.individual.net> Arno Welzel <usenet@arnowelzel.de> wrote:
Lewis:
In message <sknpai$ffl$1@dont-email.me> Dale <dale@dalekelly.org> wrote: >>>> <p>This <a href="https://www.w3docs.com/" target="_blank">hyperlink</a> >>>> will open in a new tab. </p>
No, the behavior of that is entirely up to the browser (and usually the
user's preferences). It opens a new WINDOW, which the Browser may decide >>> to open as a tab, or not.
Yes - but the browser WILL ALWAYS open something new! A user CAN NOT
prevent this if target="_blank" is present.
It certainly is possible, though I don't know if any current browsers
support that user option. But yes, there is nothing preventing a browser
for having an option "Do not allow clicks to open a new window."
On Sat, 23 Oct 2021 23:03:17 -0000 (UTC), Lewis wrote:
In message <itdaphFt4v8U2@mid.individual.net> Arno Welzel<usenet@arnowelzel.de> wrote:
Yes - but the browser WILL ALWAYS open something new! A user CAN NOT
prevent this if target="_blank" is present.
It certainly is possible, though I don't know if any current browsers
support that user option. But yes, there is nothing preventing a browser
for having an option "Do not allow clicks to open a new window."
If I remember correctly, Firefox did have such an option back in the
day
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 251 |
Nodes: | 16 (3 / 13) |
Uptime: | 26:42:55 |
Calls: | 5,545 |
Calls today: | 4 |
Files: | 11,676 |
Messages: | 5,109,644 |