Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:12:47+00:00 2026-06-11T05:12:47+00:00

I open a window with w=window.open(”,”, ‘width=1000,height=700’); than i want this window to be

  • 0

I open a window with w=window.open('','', 'width=1000,height=700'); than i want this window to be resized with proportion 10/7.
for example: 500/350; 100/70 …

i’ve maximum and minimum sizes already:

    var w;
function openwindow()
{
    w=window.open('','', 'width=1000,height=700');
    w.focus();

    resize(w);
}

function resize(w_obj) {


        w_obj.onresize = function(event) {
            width = w_obj.innerWidth;
            height = w_obj.innerHeight;

            // if popup width is greather then 1000px
            if (width > 1000) {
                w_obj.resizeTo(1000,700);
            }

            // if popup height is greather then 700px
            if(height >700) {
                w_obj.resizeTo(1000,700);
            }


            if (width < 500) {
                w_obj.resizeTo(500,350);
            }


            if(height < 350) {
                w_obj.resizeTo(500,350);
            }

        }


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:12:49+00:00Added an answer on June 11, 2026 at 5:12 am

    You should use outerHeight as that’s what resizeTo‘s arguments mean. A problem however is that you cannot know whether the user resizes the width or the height of the window. Thus, you do not know what dimension to use as the reference and which to calculate.

    Anyway, what you want is the following:

    • Clamp width and height between its minimum and maximum size. You can use Math.min/Math.max for this.
    • Set height to width multiplied by the 7 / 10 ratio.

    See http://jsfiddle.net/bSE9C/1/.

    var width = w_obj.outerWidth;
    var height = w_obj.outerHeight;
    
    width = Math.min(width, 1000);  // may not exceed 1000 maximum
    height = Math.min(height, 700);
    
    width = Math.max(width, 500);   // may not exceed 500 minimum
    height = Math.max(height, 350);
    
    height = width * 7 / 10;
    
    w_obj.resizeTo(width, height);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my javascript i want to open URL in new window with this method:
I have window.open as shown below window.open(<%=forHyperLink%>,'name_' + Math.random(),'height=600,width=800'); to open a pop up
I am using window.open as shown below window.open(<%=forHyperLink%>,'name_' + Math.random(),'height=600,width=800,resizable=0'); But i dont want
I want to open a popup window and disable the parent window. Below is
I want to open a pop up window automatically (when I open my website)
Im trying to set image in window.opener from open window like this: $(document).ready(function(){ $('a').click(function
$('#thelink').click(function(){ $('div#thedialog').dialog('open'); }); How do i change this to open window.parent´s div #thedialog.. can
I want open window.open as modal popup. var features = 'resizable= yes; status= no;
This way I get the reference to the open window: var refWin = window.open(mypage1,
i tried below javascript and it does open the url in open window but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.