hyperlink

Hi! Does anyone know how to get a page from your own website to pop up in a new window from a hyperlink? I can get it to go to the other page obviously, but not in a new window… Also is there anyway to set the new windows size? (I have a video that I want to pop up, but not show an entire web page, just the video)… Hope that makes sense!!!:>)

Jennyx


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

If your page is in XHTML Strict, then you need to use JavaScript for this. But if you are using any of the non-strict DOCTYPEs for your page, then simply pull down the Target picker in the Hyperlink dialog to ‘_blank’. That’s the official way to get a new full-sized window when you click on a link.

The JavaScript way to go (in a Strict DOCTYPE) requires some magic. Apply the Protactulous Action to your page, choose prototype-packed from the Library picker, then click on either of the Function Body buttons. Now assuming that the links you want to open in a new window are all external to your site, you could paste the following into the window:

$$('a[href^="http://"]').each(function(elm){
    elm.target = '_blank';
});

What that does is gather up an array of all links in your page whose URL begins with http:// – which will be all links that go outside of your site in a stock Freeway site – and then adds the target attribute to them “behind the back” of the W3C validator. It’s a cheesy hack, but it does allow your strict page to validate, since it’s taking the behavior (new window vs. re-use the window) out of the HTML, which is one of the reasons why this rule exists.

If you had a mix of internal and external pages that you wanted to make open in new windows, then you would need some other way to key on that fact. When making your links, you could add a ‘rel’ attribute to the link using the Extended dialog. Pick some value for this attribute that makes some sense, like new_window or just window. Then your Prototype code would look like this:

$$('a[rel~="new_window"]').each(function(elm){
    elm.target = '_blank';
});

Walter


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

And dont forget the “Link to new window” action

David


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