/    Sign up×
Community /Pin to ProfileBookmark

screen availWidth and Height

Could someone tell me why:

<script language=”javascript”>
<!–
document.write(screen.availHeight+”<br>”);
document.write(screen.availWidth);
–>
</script>

Will write the correct avail screen height and width but:
window.open(”,”,’width=screen.availWidth,height=screen.availHeight’)
will not open a window of those dimentions.
???

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@pyroMar 30.2003 — You need to do it like this:

[color=darkblue]window.open('','','width='+screen.availWidth+',height='+screen.availHeight+'');[/color]
Copy linkTweet thisAlerts:
@Ice3TauthorMar 30.2003 — Grrreat

Thankx alot. It works fine.
Copy linkTweet thisAlerts:
@Ice3TauthorMar 30.2003 — Could you explain what the extra +'s and single quotes mean and do and how I could substract 2px from it for example.

Thankx
Copy linkTweet thisAlerts:
@pyroMar 30.2003 — The extra quotation marks, and the +'s are needed to escape out of the original single quotes that you have to define the window width and height. The reason for this is because once you are inside the quotes, the script will ignore any code that you might put in there.

Check this out, to subtract 2px:

&lt;script language="javascript" type="text/javascript"&gt;

w = screen.availWidth-2;
h = screen.availHeight-2;

window.open('','','width='+w+',height='+h+'')
&lt;/script&gt;
Copy linkTweet thisAlerts:
@Ice3TauthorMar 30.2003 — Perfect!

thanks again.
×

Success!

Help @Ice3T spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...