How to find a window sate in Java Script ? I want to know whether the window is maximized or minimized ?
5 7104 acoder 16,027
Recognized Expert Moderator MVP
I'm not sure if this can be done reliably, but you can try finding the size of the window and determine from that whether it's minimised or maximised or otherwise. This link should help.
rnd me 427
Recognized Expert Contributor
a coder was close.
alert(screenX)
when minimized, you get -32000 in firefox.
when maximized, you get -4
when restored, you get something else (the position)
acoder 16,027
Recognized Expert Moderator MVP
a coder was close.
alert(screenX)
when minimized, you get -32000 in firefox.
when maximized, you get -4
when restored, you get something else (the position)
Interesting. Do you know what the values are in other browsers? Is there any sort of consistency in this inconsistency (if you know what I mean)?
rnd me 427
Recognized Expert Contributor
i was getting tired so i only tested in firebug last night.
here is a test case for your browser.
it seems ok in IE7 and FF2 for me. -
<html><head><title>dans windowstate tester</title></head><body>
-
-
announce window state in 4 seconds <input type='button' id='' name='' onclick="doMin()" value='run' />
-
-
<script type='text/javascript'>
-
function getWindowState() {
-
var S = window.screenLeft;
-
if (typeof S === 'undefined' ) {
-
S = window.screenX;
-
}
-
S=parseInt(S);
-
if (S < -4000) {
-
return "minimized";
-
}
-
if (S > -8 && S < 1 ) {
-
return "maximized";
-
}
-
return "restored: " + S;
-
}
-
-
function doMin() {
-
document.title = "change the window state now to what you want to test"
-
setTimeout(" document.title=getWindowState(); ", 4000);
-
}
-
-
</script></body> </html>
acoder 16,027
Recognized Expert Moderator MVP
here is a test case for your browser.
it seems ok in IE7 and FF2 for me.
It also works in Safari. In Opera, it works with minimized, but not maximized (gives a value of 649).
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Shayne H |
last post by:
I want to be able to add a clock to the title of a VB.NET form.
Simply updating the FormClass.Text property does not quite make it, the
titile only changes once the form is minimised/maximised.
Preferrably I'd like to use a Windows API to change the text displayed in
the TASKBAR for the form window.
Is it possible to change the title used by the taskbar to something
different to the title used by the form window?
Have been searching for...
|
by: -DRB- |
last post by:
Hi all,
I'm very much an amateur designing a page (for free!) for a friend, so
any help offered would be hugely appreciated.
I'm aiming to open a maximised window (and isn't that fun...) and
found the following script on a freescripts page to do just that... it
works perfectly.
Into head section:
|
by: JIM.H. |
last post by:
Hello,
I have a timer running in my windows .net application. While users are
working with the other applications I need to bring focus to this application
when timer elapses. If the application was minimized for example, I need to
maximize it. How can I do that?
Thanks,
Jim.
|
by: Geoff Cox |
last post by:
Hello,
Can I use JavaScript to force a maximised window ?
Thanks
|
by: Charles Law |
last post by:
When an MDI child window is minimised its height attribute returns 24 (on my
system), but when it is restored it goes back to its former height (and
width).
How can I get the restore height and width while the window is minimised? I
want to save the state of my application windows, including those that are
minimised, but I need to save the restore dimensions and not the minimised
dimensions.
TIA
| |
by: pavan377 |
last post by:
Hi folks,
I got a requirement in my project where in when my application is activated another window should get activated and upon it my application should be present. Both should be in restored state not maximised.
To accomplish this, in the activated event of my MainForm I first activated the other window and then activated my window.
I've implemented the following piece of code in the activated event of my MainForm:
private void...
|
by: tamasumalta |
last post by:
I am just new to vb.net. I used to program in vb 6. Can you kindly
indicate how I can maximise a form window to full in runtime. I think
this is a standard thing to design controls.
If this is not available then I have to drag the corners to try and
match the size for designing and setting up the controls. Altough
ticking the option "Maximised" for the field WindowState, this doesn't
have an effect in runtime and therefore controls can't...
|
by: Phil Stanton |
last post by:
Here is a bit of code which opens an Excel file from a hyperlink activated
on a form command button
CreateHyperlink Me!Storage, "", ExcelPath ' Open Excel using Hyperlink
DoEvents ' Does it's stuff
fCloseApp ("XLMAIN") ' Close ALL versions of Excel, any
spreadsheet
Application.DoCmd.Maximize ' Why not
|
by: Mark Rae [MVP] |
last post by:
Hi,
This is really just a theoretical question for my own interest, and not for
any nefarious purpose... :-)
Say we have three applications running - Notepad, Wordpad and Excel - and
each window is in its "normal" state i.e. not maximised, and not minimised
to the taskbar.
We click each of the three taskbar buttons in turn and, of course, the three
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |