PDA

View Full Version : Javascript "SHOW" Browser Toolbar



slyredfox
07-17-2007, 05:08 PM
Hi all - We've all seen the Javascript or whatever it is that opens a pop-up window and sets the property for show/hide parts of the browser ...

openWindow('http://www.address','toolbar=no,location=no,etc. etc.')"

My question is -- Is there a way to have a link in the "pop-up" window that goes to my site's home page (target _self) but resets the parts of the browser to "show".

Basically, I've had instances where people enter my site via a pop-up window (it's the first page they see). I want to give them the option of going to my sites index page (or wherever) and when they do I want to give them back all of the browser properties. Make sense?

If anyone can point me to a tutorial or sample that would be great. TY!

slyredfox
07-17-2007, 05:41 PM
Yeah, that makes sense - Thanks John.

As always I was looking for the extremely-complicated way out. When all I needed to do was to close the current window and open a new one. bingo!

jscheuer1
07-17-2007, 05:51 PM
I deleted that because it won't really work. It won't work out if the user has new windows set to open in tabs, because that tab will become a tab in the chrome-less pop up. Barring that, many browsers will close the current window before opening the new one. That part can be dealt with like so:


<a href="http://www.address" target="_blank" onmouseup="setTimeout('self.close()',200);return true;">Get your Window Back</a>

But, there is no way to override the user's settings to open a new window in a tab other than opening another pop up. You could make this be a pop up with full chrome and a large percentage of the screen, but the code for that would be a bit more involved. I'll get back to you on that if I get it worked out.

jscheuer1
07-17-2007, 06:20 PM
This works out pretty well:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
if(self.opener)
var winback=function(ref){
var nw=700, nh=500;
if(screen.availWidth){
nw=Math.floor(screen.availWidth*.9);
nh=Math.floor(screen.availHeight*.85);
}
window.open(ref,'','top=2,left=2,width='+nw+',height='+nh+',menubar,scrollbars,directories,status,location,resizable,toolbar');
setTimeout('self.close()',200);
}
</script>
</head>
<body>
<a href="http://www.address" onclick="if(winback){winback(this.href);return false;}">Get your Window Back</a>
</body>
</html>

slyredfox
07-17-2007, 09:00 PM
Thanks for working that out for me John - I'm going to implement it now.

I think it's a useful script for a web designer/developers portfolio - because if a site is search engine optimized then theoretically (sp?) a visitor could enter the site via a portfolio pop-up window and not have the opportunity to see all of the designer/developers superb work ;-)