View Full Version : Opening new windows in XHTML Basic?
theabyss
07-28-2003, 04:21 PM
Does anybody know how to create new windows using this? I know target="blank" and scripting won't validate. Is there any other way :confused:
MotherNatrsSon
07-28-2003, 04:33 PM
I do not think there is a way. The user is supposed to determine if a new window gets opened, not the webmaster, or something like that.
I disagree with it but "they" decided that was the way to do it. I like links going to external sites to open in a new window.
MNS
brothercake
07-28-2003, 04:39 PM
there is no "them" in standards development, there is only "us"; the notion of "them and us" is pure paranoia, because if you don't like how the standards are going you can get involved directly.
The reason why "target" is gone is that you shouldn't be opening new windows. If ]you as a user want a link to open in a new window, you have that choice; but if the website itself opens the window then the choice is taken away from you - there's no right-click "open in same window" that overrides target="_blank". You respect choice, right? So don't open windows - window control is the domain of the user.
Well that's one reason; another reason is that "target" has no semantics - it's meaningles in an environment which only has one window, such as WebTV or a PDA.
But there are numerous ways of hacking it javascript - intercepting click events and making them do open() commands, for example - you'd get past the validator that way. But you know, the whole point of validation is to test your page for interoperability, not to find ways of cheating the validator.
theabyss
07-28-2003, 04:46 PM
I thought maybe there was something in CSS that could do it. Who knows what it will be able to do next :D
Also, I thought there would be a standards-compliant way to open windows, but I guess not. Oh well. I can always put the phrase: "If you don't want to interupt your visit, right click on the link and select 'Open in new window'", but that would be lame. But, since I do have a personal site, not business, I probably could do that without looking bad :D
brothercake
07-28-2003, 04:51 PM
You're thinking of it from a site-owner's point of view - the idea of interrupting someone's visit - it doesn't benefit users to know when they've left your site and gone to a different one; it only benefits you.
I open new windows when I want to, and not when I don't. I'm perfectly capable of realising that two pages are or are not on the same website, just as you can. You have to respect your visitors' intelligence enough that they can do the same.
theabyss
07-28-2003, 04:59 PM
Yep, that's so true. I'll just have to settle for links opening in the same window. I'll probably put a warning message saying they're leaving the site or something.
Thanks for the feedback! :thumbsup:
DougBTX
07-28-2003, 05:51 PM
I just happened to be playing with this today:
*.js file
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.onclick = function () {
if (confirm('This is an external link.\nClick OK to open in a new window.')) {
window.open(this.href);
return false;
} else {
return true
}
}
}
}
}
window.onload = externalLinks;
HTML:
<a href="#" rel="external">click me to go some where</a>
It's an adaption of a script from a SitePoint.com article which I did after reading this thread (http://codingforums.com/showthread.php?s=&threadid=23906&highlight=confirm) here.
What do you guys think?
I don't respect my "average" visitor enough to not use IE, so I don't expect then to know how to shift click links either...
Douglas
Vladdy
07-28-2003, 06:00 PM
I got a solution that will work on any browser and any platform:
Make the content of your site so captivating that visitors will undoubtedly hit "Back" button after visiting an external link. :thumbsup:
If you do not have content that gets visitors interested, any tricks you add to keep them on your site, will only drive them away faster.
DougBTX
07-28-2003, 07:14 PM
Originally posted by Vladdy
[B]I got a solution that will work on any browser and any platform:
Naa, too difficult: Just not have any external links and take advantage of Fullscreen Flash :)
Douglas
Originally posted by brothercake
You're thinking of it from a site-owner's point of view......
........I'm perfectly capable of realising that two pages are or are not on the same website, just as you can. You have to respect your visitors' intelligence enough that they can do the same.
I have to disagree a bit here. I would be thinking of my visitors in order to try to reduce confusion over whereabouts they are within my site. Granted, the content of each site is different but it is much easier in my site for people to reach a geographical area in the main window and then research that locale in a secondary window that my site has created. Then when they have finished with that area, they can go to a new one in the main window.
As for your last sentence; we would hope so but, the disabling of the back button should imv be disallowed. Many people do not know that in the case where hitting the back button takes you nowhere, that they can use (in IE anyway), the drop down from the back button to override it. If the new site that they have gone to has a disabled back button, many people may be unable to get back to the site that they want to and may not be able to recall the URL.
And just to finish, I do respect people's intelligence. I also respect that there is a lot that the casual user of the 'net doesnt know and surely, we have to consider them too by providing easily navigable sites, which may have to use more than one window?
Discuss? (if it doesn't mean I have hi-jacked this thread).
hrsdh
07-29-2003, 01:13 AM
Surely if a site is well designed and thought-out/planned, there should be no need for the opening of seperate windows - visitors ought to be able to navigate to all parts of the site quickly, simply and easily. This is where having (at the very least) links to all the major sections of the site accessable from all pages on that site is a great step forward. One or two scenarios where a fresh window may be beneficial IMHO are (a) viewing an "enlargement" of a thumbnail graphic or (b) when viewing a printer-optimised version of the page.
DougBTX
07-29-2003, 01:25 AM
Originally posted by hrsdh
(b) when viewing a printer-optimised version of the page.
That is what print preview and print style sheets are for...
No comments on my "ask the user what they want to do" script? Ohh..
Douglas
hrsdh
07-29-2003, 01:45 AM
I am very much in favour of preparing print-optimised content server-side and telling the browser to use a seperate print-optimised CSS (which in the case of most of my work will incorporate CSS positioning).
With regard to the idea of your function to give the user the choice to open the link in a fresh window: yes, I like it :o)
MotherNatrsSon
07-29-2003, 04:26 AM
Originally posted by DougBTX
That is what print preview and print style sheets are for...
No comments on my "ask the user what they want to do" script? Ohh..
Douglas
I like it but the accessability people will shoot it down. If you want to have an accessible site that won't work either.
I respect, but suspect that most people are clueless and can barely operate email let alone use many of the functions available in a web browser. I know too many first hand that when showing them simple little things many take for granted about a web browser and how they can do things with it. I hear this alot,"I NEVER knew you could do THAT!" LOL
MNS
theabyss
07-29-2003, 06:28 AM
I'm not sure what I want to do now. I want users to be able to click on my page validation links to see the error-free results :) , but I don't want them to leave the site completely. How does that <a href="#" rel="***"> thing work??? Doesn't that still require a script tag :confused:
brothercake
07-29-2003, 07:02 AM
Originally posted by theabyss
How does that <a href="#" rel="***"> thing work??? Doesn't that still require a script tag :confused:
Yes, it's just a hack for cheating the validator .. you intercept document click events and if they come from an obj with rel="new" or something, you do an open command on the object href. It's so-called "new windows in a standards-compliant world", but it isn't standards compliant at all, because it totally misses the point.
Originally posted by bazz
it is much easier in my site for people to reach a geographical area in the main window and then research that locale in a secondary window that my site has created.
It may be easier for you, but everybody else is not you. For others, using the same window and the back button may be preferable. Either way, you don't need to specify targets to give people that choice - they already have that choice via their browser options. If you wanna do something to improve usability on your site - write a help guide that tells people more about their browser options :thumbsup:
Not opening new windows is about not imposing your preferences on your visitors. A link with no target can be controlled by the user - to a new tab, or a new window, or whatever. A link that does have a target cannot be controlled by the user to the same extent - you can't right-click and force a _blank link to open in the same window. (although .. methinks I should suggest this to mozilla as a usability enhancement)
Window control does not make it easier for anybody. This is a myth propagated by people who seek to use "usabilty" as a buzzword in order to justify their own commercial agenda, or their own lack of understanding .
The only reason why so few users realise they can control windows is because they're used to [i]not being able to control windows, because so many sites disrespect them in this way, it just seems like the norm. It won't get better until we stop doing it.
theabyss
07-29-2003, 08:56 AM
That rel thing could cheat the validator, but not the script tag. It's cool that they have a Basic DTD that's restrictive like that. There's no way you can cheat the validator with XHTML Basic. It's so easy to cheat the validator with other DTDs, though. All they have to do is use a document.write in script. Pretty lame, huh? :rolleyes:
I agree that all sites shouldn't control windows for their pages. It starts becoming debatable when you talk about external sites, but even then, I would say that if the user wanted a new window, they would use a right click. Not a left click. I've come to the conclusion that if the web designer doesn't want a page to open in the same window, they should put a message detailing how to right click and select "Open Link in New Window (or Tab)". It would be nice if Mozilla had a function where all internal links would open in the same window, that would be awesome! :thumbsup:
DougBTX
07-29-2003, 01:04 PM
Originally posted by theabyss
That rel thing could cheat the validator, but not the script tag. It's cool that they have a Basic DTD that's restrictive like that. There's no way you can cheat the validator with XHTML Basic.
So don't cheat, just include the "Intrinsic Events Module" and the "Scripting Module" and you are sorted, 100% valid.
That is what XHTML Basic is for, adding modules when you want to use them :)
Douglas
Surely if a site is well designed and thought-out/planned, there should be no need for the opening of seperate windows - visitors ought to be able to navigate to all parts of the site quickly, simply and easily. This is where having (at the very least) links to all the major sections of the site accessable from all pages on that site is a great step forward.
OK, but I'd rather not have 300 links in my page as it would look pretty crap. Much easier in my view to have just one new window open and when having finished seeing its content, close it with one click to retrun to the previous point they were at.
spose, choice is there for the designer too. :cool:
theabyss
07-29-2003, 05:28 PM
Even though Microsoft's site is so horribly built, they at least have the intelligence to have navigation so it doesn't open any windows. It might take 4 or 5 clicks to get somewhere, but that's what it takes sometimes.
If someone has a site that has tons of links, there's some great 3 or even 4 column layouts available. All without tables too! The columns will make it very easy to have a good navigation structure. I'm redesigning my site right now with one of the zen Garden templates. I'm choosing this one (http://www.csszengarden.com/?cssfile=http://benn.orcon.net.nz/utilitarian.css)
My site right now is getting too cluttered, so I need columns to sort things out better. But, all this positioning stuff is kinda getting me frustrated, but oh well. It'll pass :D
DougBTX
07-29-2003, 10:24 PM
Originally posted by theabyss
I'm choosing this one (http://www.csszengarden.com/?cssfile=http://benn.orcon.net.nz/utilitarian.css)
I love the irony that in a post against opening new windows, there is a link which opens in a new window...
Douglas
theabyss
07-30-2003, 12:36 AM
Yeah, that is kinda funny :D
spl1nter
03-27-2004, 07:01 PM
There is a use for opening a new window that hasn't been discussed here.
I'm developing a forum software and want it to be very customisable for the owner. I am offering them the option to alter the site online.
I was planning on letting the owner alter something and before they saved the new look they could click on a link that would open a new window showing how the bit they just altered would look.
e.g. If they changed the background colour of the menu they would click a link and a window would popup containing only the menu.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.