Can anyone suggest some javascript code that will refresh the browser window when the window is resized to a specific height. Similar to CSS Media queries.
i.e if the browser max-height is 700px then refresh.
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
I’ve recently been doing something similar, and there’s a nice JavaScript function that I’m using:
This will get the current height and width of the browser. If you want to check when the user is resizing the page and call the
resize()function, just use a simple JavaScript commandwindow.onresize=resize();This is the basic function. From here it should be easy enough to make some changes to the code. For example, if you want the page to be refreshed only when the width becomes greater than or equal to 700, add something like this to the
resize()function: