<a href="somewhere.html" target="otherwindow">Click Here</a>
If there is currently no window open with the name otherwindow, a new window will open. Future clicks on links with the target attribute otherwindow will reuse that window.
We can solve the problem with JavaScript code like this:
<script> window.name = "otherwindow"; </script>
Including this code in the <head> element of the www.example.com home page will take care of renaming the window.
In this case, we've used the name otherwindow. But when you use this technique in practice, we recommend using a name that is fairly unique to your site, such as examplecom_otherwindow. Window names like help or main can lead to confusion when the user navigates to other sites which unexpectedly reuse that window in strange ways.
Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.
Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!
Follow us on Twitter | Contact Us
Copyright 1994-2012 Boutell.Com, Inc. All Rights Reserved.
