/    Sign up×
Community /Pin to ProfileBookmark

Can I Launch a New Window at a Fixed Width and Height?

When a user clicks a link, can I have the window that launches open at a fixed width and height?

If so, how would I do that?

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@misteralexanderMar 11.2005 — Yes you can. You can do it with JavaScript & the "window.open" funtion.

[CODE]
window.open("Sample.htm",null,
"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
[/CODE]


Go to:[URL]msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/open_0.asp[/URL] to read up on it in much detail.
Copy linkTweet thisAlerts:
@duderdude2authorMar 11.2005 — Thanks, but is that the only way?

I'm leery of using Javascript for anything in case the user has it disabled. What would happen if a user who has javacript disabled clicked on the link?
Copy linkTweet thisAlerts:
@phpnoviceMar 11.2005 — [i]Originally posted by duderdude2 [/i]

[B]Thanks, but is that the only way?[/B][/QUOTE]

The only way to have any control over the format of the new window, yes. As for disabled JavaScript, the window would just open as per usual -- if you code it as follows:
<i>
</i>&lt;a href="link" target="_blank" onclick="javascript&amp;#58;
window.open(this.href, this.target, 'width=300,height=200,resizable,scrollbars');
return false;"&gt;text&lt;/a&gt;

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
Copy linkTweet thisAlerts:
@duderdude2authorMar 11.2005 — Thanks, I checked out that page too, which is interesting.

Just one more question. Is there a way I could include a "close" button, in addition to the "X" in the top right of the browser window?
Copy linkTweet thisAlerts:
@phpnoviceMar 11.2005 — Yes, but of course this won't work at all if JavaScript is disabled -- no graceful degraded functionality here. ?

<button type="button" onclick="javascript&#58;top.close();">Close</button>
×

Success!

Help @duderdude2 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...