SimpleGuy
SimpleGuy

Reputation: 2904

How to open new browser window (not tab) and then resize it using jQuery / Javascript

I am trying to make a web application, which will mostly be used in my own company (for internal usage). Since the application's UI is not much, so I though that it would be a good idea to make a website target for low resolution (400x600 resolution) and when a client (from PC browser) makes a request to website,

So it would just look like a chat-type-of messenger app. But there are two things extra which I want to do. (See attached screenshot, of what happens till now)

Can someone please help ?

enter image description here

Upvotes: 0

Views: 1827

Answers (1)

KAD
KAD

Reputation: 11122

This shall do you the trick:

<button onclick="openNewWidow(500,100)" > OPen </button>

<script language="javascript">

function openNewWidow(width, height) {
    var top = parseInt((screen.availHeight) - height - 100);
    var left = parseInt((screen.availWidth) - (width / 2));
    var features = "location=1, status=1, scrollbars=1, width=" + width + ", height=" + height + ", top=" + top + ", left=" + left;
    window.open("test.html", "kad", features);
    window.close();
}

</script>

Upvotes: 1

Related Questions