Forum Moderators: open

Message Too Old, No Replies

opening a resized window with no toolbar

need a check to this code please

         

tito

7:44 am on Jan 24, 2008 (gmt 0)

10+ Year Member



Hello,

I'm trying to use this into a window I want to open resized, with no toolbar etc... but I can't make it work:

<script type="text/javascript">
function initPage() {
newwindow=open(sURL,"newwin","scrollbars=no, toolbar=no,
directories=no, menu bar=no, resizable=no,
status=yes, width=600, height=500");
}
</script>

<body onload="initPage()">

the following it works, but I need to make it with no toolbar etc...

<script type="text/javascript">
function initPage() {
window.moveTo(0, 0);
window.resizeTo(500, 400);
}
</script>

<body onload="initPage()">

Please, what I'm doing wrong?

Thanks!
tito

Fotiman

3:41 pm on Jan 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Please, what I'm doing wrong?

Answer: You're trying to open a resized window with no toolbar.

This is bad usability. Users don't like to have windows opened with no toolbar. My advice is to abandon this approach.

rocknbil

5:59 pm on Jan 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Absolutely, new windows should be supplemental - you may not even be able to do this with a "main window." Additionally, IE7 will not allow a window without an address bar.

But if you were to view the Error Console in FireFox, you would see one of the errors is "sURL is not defined."

In this scenario, you would need to pass a value to the function.

<a href="#" onClick="return initPage('mypage.html');">New window here</a>

<script type="text/javascript">
function initPage(sURL) {
var day = newDate();
var id=day.getTime();
if (! sURL) { alert('you need to pass a URL value.'); }
else { newwindow=open(sURL,id,'width=600, height=500'); }
return false;
}
</script>

Note I just left out the attributes you don't want. No reason to specify "no."

Dabrowski

8:19 pm on Jan 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should condsider a CSS popup - create a hidden layer with black semi-transparent backgound with your popup inside that. When you show it the page appears to grey out, with the new window on top.

It's much more stylish - and is popup blocker friendly.

tito

4:23 am on Jan 25, 2008 (gmt 0)

10+ Year Member



I see. I will go for a CSS popup.

Thanks for your explanations n suggestions.

Best,
tito