javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
ansuriya
Forum Newbie
Posts: 2
Joined: Sun Jul 11, 2010 4:18 am

javascript

Post by ansuriya »

How do you make a page open in a specific height and width using javascript? I am building a web site and I want the first page by default to open up in a specific width and height. I konw how to open a new window in a specific height and width using javascript, but I dont know how to make the first page open up in a specific size. Is there any way to do this using Javascript?
__________________________
keyword research ~ keyword tool ~ keyword tracking ~ affiliate elite
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: javascript

Post by Jade »

Code: Select all

<script type="text/javascript">
function popup(url, width, height)
{
      window.open(url, "width=" + width + ", height=" + height);
}
</script>
<a href="popup('google.com', 500, 400)">Open a mini google window!</a>
There are additional options besides height and width. You can read about them here http://www.javascript-coder.com/window- ... open.phtml
Forumguru
Forum Newbie
Posts: 10
Joined: Sat Jul 31, 2010 7:15 am

Re: javascript

Post by Forumguru »

The opening page url you are using is passed to the function when we call it, so that this function can be used for any number of different pop-ups though the height/width and other options will always be the same unless you modify the function to take more arguments. Some browsers prohibit the opening of pages on another server for security reasons. It is better to test your script again.
Post Reply