New windows
I've been searching and searching for an answer to this, but no one seems to know how to do it! So, does anyone here know how to open a new window when you click a link? Here's what I want:
A window that I can choose the height and width for
A window that cannot be re-sized
A window that has no tool bar/ address bar
A window that has no scrolling
Any help would be great. Thanx people! :explode:
This post is suitable for vegetarians
Busy posted this at 22:44 — 13th May 2005.
He has: 6,151 posts
Joined: May 2001
try search for popup
chrishirst posted this at 09:02 — 14th May 2005.
He has: 379 posts
Joined: Apr 2005
Chromeless Window
Abhishek Reddy posted this at 10:44 — 14th May 2005.
He has: 3,348 posts
Joined: Jul 2001
Avoid this. It's a usability sin.
Anyhow, it's not properly cross-platform; you'd have to provide some kind of redundancy to make content accessible in Javascript-restriced or -disabled browsers.
Don't use popups if a simpler alternative will work. Few are the times when popups are necessary, useful and functional.
Assassin posted this at 22:25 — 14th May 2005.
He has: 77 posts
Joined: Apr 2005
It's excessively simple to make that pop-up using Javascript. But if you want it to be cross-platform the best that I can do for you is tell you to put a target="_blank" argument into your tag. You might be able to find a value for the target that changes the way it all works a little. I don't really know all possible target values.
Assassin Band Website
chrishirst posted this at 09:20 — 15th May 2005.
He has: 379 posts
Joined: Apr 2005
While target="_blank" will open a new window it doesn't answer the original question.
Yes some types of pop-up code are distinctly unfriendly to javascript disabled user agents. However it is reasonably simple to code one that is a sizeable new window and will degrade gracefully in JS disabled UAs to a simple link.
This code in the head (in script tags) or in a linked external .js file (preferred)
// javascript popup sizeable window
function NewWindow(mypage, myname, w, h, scrolling) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+ h +',width='+ w +',top='+ wint +',left='+ winl +',scrollbars='+ scrolling +',resizable='+'no'+',menubar='+'no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
<a href="URI" onClick="NewWindow(this.href,'names','330','350','no');return false;">Anchor Text</a>
then to make it so it doesn't simply become an orphaned page in the SERPs add this code to the pop-up page
<script type="text/javascript">
<!--
var winname = window.name;
if (winname == "names")
{
document.write("<a href='' onClick='window.close()'>Click here to close the window.</a>")
}
else
{
document.write("This page is seen out of context click below for<br>the ")
document.write("<a href='site_URI'>Anchor Text</a>")
}
//-->
</script>
This code is not affected by XP SP2 and will bypass most blockers because it is a user action to generate the pop-up.
Chris
Indifference will be the downfall of mankind, but who cares?
Venue Capacity Monitoring
Code Samples
bja888 (not verified) posted this at 16:08 — 15th May 2005.
They have: 5,633 posts
Joined: Jan 1970
Pop up blockers shoukd block pop-ups the user does not trigger. While If the user does something to trigger it. Then it will work.
target="_blank" will not allow you to take out tool bars you will have to use window.open();
Roo posted this at 20:15 — 15th May 2005.
She has: 840 posts
Joined: Apr 1999
Popups are fine, just do NOT use chromelss windows,
Service pack 2 for XP made chromeless windows not work anymore.techniner posted this at 14:40 — 24th May 2005.
They have: 19 posts
Joined: May 2005
You do realize that those popups will be blocked by SP2.....
and Firefox as well...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.