JT said:
sjoerd wrote:
"maximized"-position (is fullscreen)?
Presuming you understand the reasons and arguments for not opening another
window, but have concluded opening a new window is the way you wish to
display your site. Then this is one way Sjord:
Put this in the <Head> area of your links page
<script type="text/javascript">
function Start(page) {
OpenWin = this.open(page, "CtrlWindow",
"toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
}
</script>
Then use this for the link itself
<a href="javascript:Start('the _name_of _your_file.htm')">Your text</a>
Sorry but I need to correct a few things with your answer.
Using the "javascript:" pseudo-protocol is bad, wrong, bound to create
problems.
1- If javascript is disabled, then the new window will not be created,
nor opened. The referenced resource will not even be loaded in the
window. With target="CtrlWindow" and a real url as the href value, it
would have in a new window. With a real url as the href, it would have.
2- An user right-clicking the link and choosing to open the referenced
resource in another tab will not succeed. With a proper code, it would have.
3- An user right-clicking the link and choosing to open the referenced
resource in the same window will not succeed. With a proper code, it
would have.
4- An user right-clicking to see the property of the link will be
deceived and totally mislead. The browser will too.
<a href="the _name_of _your_file.htm" target="CtrlWindow"
onclick="Start(this.href); return false;">Your text</a>
I'm happy that you inserted "resizable=yes,scrollbars=yes": 2 basic
accessibility and usability features that unfortunately a lot of webpage
turn off.
There are still issues with the given code. If the secondary window has
lost focus, the code given will not give it back focus if the user
clicks again on the link: more code would be needed to adjust this.
More reading:
Top Ten Web-Design Mistakes of 2002
6. Javascript in links
http://www.useit.com/alertbox/20021223.html
comp.lang.javascript FAQ
http://jibbering.com/faq/#FAQ4_24
"Don't use javascript: URLs
Using a straight http: URL will allow any browser to access the link. If
you want to use JavaScript for browsers that have JavaScript enabled,
use the onMouseOver and onClick attributes of the <a href> tag. (...)"
http://www.rahul.net/aahz/javascript.html#remove
What I preach and what I practice:
http://www10.brinkster.com/doctorunclear/Netscape7/Popup/PopupAndNetscape7.html#OpenLinkNewWindow
http://www10.brinkster.com/doctorunclear/BrowserBugsSection/Opera7Bugs/Opera7Bugs.html
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html