rejetto forum

Software => HTML & templates => HFS ~ HTTP File Server => RAWR-Designs => Topic started by: fPortal on February 09, 2009, 02:07:41 AM

Title: Open in new window code for file system.
Post by: fPortal on February 09, 2009, 02:07:41 AM
I have been looking and cannot find this.
On my file system, I have my lists of folders and files, but I have a link as well.  Is there a way to make that link open in a new window like with a target command?
Title: Re: Open in new window code for file system.
Post by: fPortal on February 09, 2009, 02:08:55 AM
Nevermind, I found a way in the template file.

Thank you anyway.
Title: Re: Open in new window code for file system.
Post by: chthonic on March 05, 2009, 02:16:56 PM
I was trying to locate the code I was given before for the same thing and I cant find my original post anywhere!.. would you mind sharing how you did it?

it would be greatly appreciated
Title: Re: Open in new window code for file system.
Post by: rejetto on March 06, 2009, 02:05:59 PM
mmm, i think this behavior should be included in the default template.

if no one disagrees with this, i will just go this way.
Title: Re: Open in new window code for file system.
Post by: chthonic on March 06, 2009, 02:10:10 PM
LOL hi rejetto!


it would be a very useful thing.... even tho I searched the template code and made manual changes... it was still a bit of a task.. to make sure I didnt mess anything else up.

this would also prevent users from accidentally navigating away from the host site
Title: Re: Open in new window code for file system.
Post by: r][m on March 06, 2009, 03:43:25 PM
Quote
mmm, i think this behavior should be included in the default template
Would be OK, but it can be done when setting url for link in vfs like:
Code: [Select]
http://www.google.com/"target=blank"
Title: Re: Open in new window code for file system.
Post by: rejetto on March 06, 2009, 07:58:35 PM
this test should be ok to detect URLs outside hfs

check url for "://" and not (%host% or %ip%)

in template macros translates to

{.and| {.pos|://|%item-url%.} | {.not|{.pos|%host%|%item-url%.}{.pos|%ip%|%item-url%.}.}
Title: Re: Open in new window code for file system.
Post by: chthonic on March 06, 2009, 10:17:53 PM
I just added the target=_blank to the two sections in terayon 1.3.2 that handle URL's

as I said.. had to be very careful and make sure I wasnt messing up other links

having this be a default function is less hassle
Title: Re: Open in new window code for file system.
Post by: bacter on March 07, 2009, 12:04:18 AM
There are also many cases where we dont want that a link opens a new browserwindow. If the user want's to open the link in a new window or tab, he can already do so rightclicking on the link.
Title: Re: Open in new window code for file system.
Post by: chthonic on March 07, 2009, 12:15:19 AM
that's why they are called "options"

one could be to open in a new window.. another could be to force it to open in a frame and keep it on the same site with navigation.. that way you can view the external and still not leave the HFS server.

I use picture galleries because 250+ images load faster than if I used the thumbnail generator for the template... as a result.. its less hassle for those to open as a new window.

it's a simple matter regarding "ease of use"

I have several people asking me how to setup HFS and stunnel etc... more than willing to show them how.. but they aren't as computer technical as I am.. so they need easier options.
Title: Re: Open in new window code for file system.
Post by: rejetto on March 09, 2009, 11:58:09 PM
There are also many cases where we dont want that a link opens a new browserwindow. If the user want's to open the link in a new window or tab, he can already do so rightclicking on the link.

ok. you suggest it is not good that we do it always (by default) ?

i will delay this thing so that we can decide for the better.
maybe an option in the gui is the correct solution.
a global option, or inside the link itself.
unsure.
Title: Re: Open in new window code for file system.
Post by: rejetto on March 10, 2009, 02:15:27 AM
Would be OK, but it can be done when setting url for link in vfs like:
Code: [Select]
http://www.google.com/"target=blank"

very nice workaround!
Title: Re: Open in new window code for file system.
Post by: chthonic on March 10, 2009, 12:24:13 PM
make it an option in the gui.. that way we can decide on a per link basis.. something like...

option1: default = open in same window
option2: open in new tab
option3: open in new window

with additional option to make it the default behavior ... which can be over-ridden by custom link settings such as...

LINK OPTIONS: then can choose how that particular link works

Title: Re: Open in new window code for file system.
Post by: Kremlin on March 11, 2009, 12:14:41 AM
Found r][m solution very good, simple and effective.
Title: Re: Open in new window code for file system.
Post by: rejetto on March 12, 2009, 06:31:32 PM
there's nothing i can do to decide to open in tab or window.
this depends on the browser.
i guess a flag "open in new window" in the link properties is a good solution.

r][m solution is good, but cannot be thought as general solution for the masses.
Title: Re: Open in new window code for file system.
Post by: TSG on March 16, 2009, 04:55:01 PM
I didn't know appending that to the url would open a new window...

target="_blank" is the only way, Unless you want to use javascript, then anything is possible, however it is more complex.

It depends on the browser and options like you have all said here. Rejetto should not have to add this as a feature of hfs.

To be honest I used to target="_blank" a lot of links. But it decreases usability and can be annoying for users. A lot of people like to select for themselves. In Firefox it is the first option in the context menu of a link. It is best to keep most links within the same site opening in the same window. Some external links might be best as a new window, but I even find most people prefer external links opening in the same window, even if it does draw attention away from your own website.
Title: Re: Open in new window code for file system.
Post by: Unknown8063 on March 17, 2009, 02:20:38 PM
I also didn't know you could append that to a URL :p

The company I work for uses target="_blank" fairly regularly and so do a lot of other sites.  However, the web standards are in agreement with TSG - the decision to open a page in a new window/tab should be left with the user and not determined in code.  In fact, in the W3C standards the target attribute is not part of (X)HTML Strict and is intended to only be used in conjunction with frames.
Title: Re: Open in new window code for file system.
Post by: chthonic on March 17, 2009, 02:39:25 PM
I am just trying to balance ... what if the link in the template were to reflect the option to open in a new window/tab instead?...

Link = regular behavior
     [option1= open in new window]     [option2= open in new tab]
Title: Re: Open in new window code for file system.
Post by: rejetto on March 17, 2009, 03:05:43 PM
I also didn't know you could append that to a URL :p

you can't.
the workaround suggested by r][m is a sort of injection[1]. it works because HFS merely copies what you typed inside the tag.

[1] just as the ones used for attacks