[Pro] New browser window

Can someone please tell me how to create a hyperlink that creates a new page with url instead of redirecting the visitor to the new address new clicked.
I’m simply trying to create a link to Map Quest with direction to the office and would like to close it when done viewing.
Thanks for the help!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Do you mean you would like the new page to open in a new window? So that when the user clicks ‘close’ on the new window, the main web page is still showing?

Nathan Garner
Creative Director

Austin Wells Design Limited
One Elmgate Drive - Littledown - Bournemouth BH7 7EF
t 01202 301271 e email@hidden w http://www.austinwellsdesign.co.uk

Member of NAPP | Zen Affiliate | Dorset Business Member | YEC

Facebook | Twitter | LinkedIn

On 29 Apr 2010, at 17:01, Cory Falter wrote:

Can someone please tell me how to create a hyperlink that creates a new page with url instead of redirecting the visitor to the new address new clicked.
I’m simply trying to create a link to Map Quest with direction to the office and would like to close it when done viewing.
Thanks for the help!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Nathan,
That’s exactly what I’m trying to do…
Thanks, C


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

When you select your text to make the link (Apple-K) in the the dialogue box that opens there is a section near the bottom where you can choose Target options.

The one you want is _blank.

But there are certain doc types that will not allow this - the Strict ones.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Dave… pefecto.
You’re always a huge help.
Thanks again… C


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So does that mean that there is no way to accomplish this using strict xhtml? That sounds weird.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s easy to add using JavaScript. Try the Spawn New Window
(ActionsForge) or any of the other New Window Actions that come with
Freeway. The thinking of Strict is that the browser belongs to the
user, and anything that takes that control away (resizing, opening,
closing windows) should not be undertaken by the site the user visits.
But if you really must, the Web is separated into neat areas of
concern. CSS for presentation, HTML for content and structure,
JavaScript for behavior.

Walter

On Jun 5, 2010, at 5:17 PM, edgework wrote:

So does that mean that there is no way to accomplish this using
strict xhtml? That sounds weird.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So does that mean that there is no way to accomplish this using
strict xhtml? That sounds weird.

It’s not possible using

<a href="document.html" target="_blank">external link</a>

but it can be done using the compliant

<a href="document.html" rel="external">external link</a>

and some javascript

function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
  }
}
window.onload = externalLinks;

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just to be clear, if you use the Extended dialog in Freeway, you can
add target="_blank" to a link. But the page will no longer be valid
(X)HTML Strict.

This JavaScript trick Todd has listed below does precisely that, and
exploits the fact that the W3 Validator does not consider changes to
the code wrought through JavaScript. It’s not written directly in the
HTML, so the HTML is considered valid, but by the time the browser
shows it to you (having modified it through script) the HTML is no
longer valid.

Walter

On Jun 5, 2010, at 5:42 PM, Todd wrote:

So does that mean that there is no way to accomplish this using
strict xhtml? That sounds weird.

It’s not possible using

<a href="document.html" target="_blank">external link</a>

but it can be done using the compliant

<a href="document.html" rel="external">external link</a>

and some javascript

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "external")
    anchor.target = "_blank";
}
}
window.onload = externalLinks;

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

but by the time the browser shows it to you (having modified it
through script) the HTML is no longer valid.

When I use the js technique I get valid Strict markup. Perhaps I’m
misunderstanding things?

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You are stepping around the W3C validator. Strictly speaking, the
attribute ‘target’ is not there in the HTML, and only after a browser
(as opposed to a validator, which does not execute any JavaScript,
remember) executes the code in the page, does it appear anywhere.

A page that includes this script honors the letter, but not the
spirit, of the W3C standards. The spirit of the standard is “thou
shalt not mess with the browser, it does not belong to you”. The
validator is not smart enough (or intrusive enough) to determine if
you have honored the spirit of the standard, only the letter.

Walter

On Jun 6, 2010, at 1:59 PM, Todd wrote:

but by the time the browser shows it to you (having modified it
through script) the HTML is no longer valid.

When I use the js technique I get valid Strict markup. Perhaps I’m
misunderstanding things?

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ah, got it. Thanks.

I find it interesting that so many Standards drum-beaters who bemoan
target _blank find the js way more appropriate. I simply don’t see
either has having any real advantage; they both work. Except of course
that you can have valid Strict markup with a little js sleight of
hand. I’m probably overlooking something.

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You can turn JavaScript off in the browser, but you can’t turn off the _blank thing. That’s my theory why they would be okay with it. There’s also that “separation of concerns” thing I was referring to earlier. HTML is content and structure ONLY, and JavaScript is behavior and logic ONLY, and CSS is presentation ONLY. Of course it’s rarely that pure, but that’s the dream anyway.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You can turn JavaScript off in the browser, but you can’t turn off
the _blank thing. That’s my theory why they would be okay with it.

Yes, I can see where that would be beneficial for some.

For those interested here’s a more user-friendly example than the one
I posted earlier. I haven’t tried it and there are no doubt many other
examples but it may be worth a look. <http://www.456bereastreet.com/archive/200605/opening_new_windows_with_javascript_version_11/

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options