Window: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 8: Line 8:


{| class="wikitable"
{| class="wikitable"
|-
|applicationCache || An object with the status of the application cache.
|-
|applicationCache.status || The current status of the cache. If 1, an update is pending.
|-
|-
|body || The body of the window
|body || The body of the window
Line 106: Line 110:
'''window object events'''
'''window object events'''


Not all events occur in all browsers. The version of the browser may also influence which are active.
{| class="wikitable"
{| class="wikitable"
|-
|-
|ondeviceorientation() || Script to run if device orientation (compass) changes
|onabort() || Script for abort events on the window.
|-
|onbeforeunload() || Script for before-unload events on the window.
|-
|onblur() || Script for blur events on the window.
|-
|onchange() || Script for change events on the window.
|-
|onclick() || Script for click events on the window.
|-
|onclose() || Script for handling the window close event.
|-
|oncontextmenu() || Script for right-click events on the window.
|-
|ondevicelight() || Script for any ambient light levels changes
|-
|ondeviceorientation() || Script for any device orientation changes
|-
|ondeviceproximity() || Script for device proximity event
|-
|ondragdrop() || Script for drag and drop events on the window.
|-
|onerror() || Script for errors raised on the window.
|-
|onfocus() || Script for focus events on the window.
|-
|onhashchange() || Script for hash change events on the window; called when the part of the URL after the hash mark ("#") changes.
|-
|onkeydown() || Script for keydown events on the window.
|-
|onkeypress() || Script for keypress events on the window.
|-
|onkeyup() || Script for keyup events on the window.
|-
|onload() || Script for window loading.
|-
|onmousedown() || Script for mousedown events on the window.
|-
|onmousemove() || Script for mousemove events on the window.
|-
|onmouseout() || Script for mouseout events on the window.
|-
|onmouseover() || Script for mouseover events on the window.
|-
|onmouseup() || Script for mouseup events on the window.
|-
|onmozbeforepaint() || Script for the MozBeforePaint event, which is sent before repainting the window if the event has been requested by a call to the Window.mozRequestAnimationFrame() method.
|-
|onpaint() || Script for paint events on the window.
|-
|onpopstate() || Script for popstate events, which are fired when navigating to a session history entry representing a state object.
|-
|onreset() || Script for reset events on the window.
|-
|onresize() || Script for window resizing.
|-
|onscroll() || Script for window scrolling.
|-
|onselect() || Script for window selection.
|-
|-
|onoffline() || Script to run if device loses connection to the net.
|onsubmit() || Script for submits on window forms.
|-
|-
|ononline() || Script to run when device gets connection to the net.
|onunload() || Script for unload events on the window.
|-
|-
|onorientationchange() || Script to run if the screen is rotated.
|onuserproximity() || Script for user proximity events
|-
|-
|onpagehide() || Script to run if the app is hidden. May behave differently depending on platform.
|onpageshow() || Script for pageshow events on the window.
|-
|-
|onpageshow() || Script to run if the screen is shown. May behave differently depending on platform.
|onpagehide() || Script for pagehide events on the window.
|-
|-
|onvisibilitychange(v) || Script to run if the screen is shown or hidden. Returns True or False.
|onvisibilitychange(v) || Script to run if the screen is shown or hidden. Returns True or False.

Latest revision as of 12:36, 19 March 2015

NSB/AppStudio programs run within a special version of a web browser. As a result, they can inherit a lot of the properties of the environment they run in. You can access these properties from within your app.

It is not a complete list: there are additional items in the full HTML documentation. In addition, some browsers may have additional members not shown here.

window object members

applicationCache An object with the status of the application cache.
applicationCache.status The current status of the cache. If 1, an update is pending.
body The body of the window
closed Returns a Boolean value indicating whether a window has been closed or not
defaultStatus Sets or returns the default text in the statusbar of a window
devicePixelRatio The number of pixels the device has for each one the browser uses.
document Returns the Document object for the window (See Document object)
frames Returns an array of all the frames (including iframes) in the current window
history Returns the History object for the window
innerHeight Sets or returns the the inner height of a window's content area
innerWidth Sets or returns the the inner width of a window's content area
length Returns the number of frames (including iframes) in a window
location Returns the Location object for the window
name Sets or returns the name of a window
opener Returns a reference to the window that created the window
orientation Returns the current screen rotation (0,90,180,-90)
outerHeight Sets or returns the outer height of a window, including toolbars/scrollbars
outerWidth Sets or returns the outer width of a window, including toolbars/scrollbars
pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parent Returns the parent window of the current window
screen Returns the Screen object for the window (See Screen object)
screenLeft Returns the x coordinate of the window relative to the screen
screenTop Returns the y coordinate of the window relative to the screen
screenX Returns the x coordinate of the window relative to the screen
screenY Returns the y coordinate of the window relative to the screen
self Returns the current window
status Sets the text in the statusbar of a window
top Returns the topmost browser window
alert() Displays an alert box with a message and an OK button
blur() Removes focus from the current window
clearInterval() Clears a timer set with setInterval()
clearTimeout() Clears a timer set with setTimeout()
close() Closes the current window
confirm() Displays a dialog box with a message and an OK and a Cancel button
createPopup() Creates a pop-up window
focus() Sets focus to the current window
moveBy() Moves a window relative to its current position
moveTo() Moves a window to the specified position
open() Opens a new browser window
print() Prints the content of the current window
prompt() Displays a dialog box that prompts the visitor for input
resizeBy() Resizes the window by the specified pixels
resizeTo() Resizes the window to the specified width and height
scroll()
scrollBy() Scrolls the content by the specified number of pixels
scrollTo() Scrolls the content to the specified coordinates
setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds

window object events

Not all events occur in all browsers. The version of the browser may also influence which are active.

onabort() Script for abort events on the window.
onbeforeunload() Script for before-unload events on the window.
onblur() Script for blur events on the window.
onchange() Script for change events on the window.
onclick() Script for click events on the window.
onclose() Script for handling the window close event.
oncontextmenu() Script for right-click events on the window.
ondevicelight() Script for any ambient light levels changes
ondeviceorientation() Script for any device orientation changes
ondeviceproximity() Script for device proximity event
ondragdrop() Script for drag and drop events on the window.
onerror() Script for errors raised on the window.
onfocus() Script for focus events on the window.
onhashchange() Script for hash change events on the window; called when the part of the URL after the hash mark ("#") changes.
onkeydown() Script for keydown events on the window.
onkeypress() Script for keypress events on the window.
onkeyup() Script for keyup events on the window.
onload() Script for window loading.
onmousedown() Script for mousedown events on the window.
onmousemove() Script for mousemove events on the window.
onmouseout() Script for mouseout events on the window.
onmouseover() Script for mouseover events on the window.
onmouseup() Script for mouseup events on the window.
onmozbeforepaint() Script for the MozBeforePaint event, which is sent before repainting the window if the event has been requested by a call to the Window.mozRequestAnimationFrame() method.
onpaint() Script for paint events on the window.
onpopstate() Script for popstate events, which are fired when navigating to a session history entry representing a state object.
onreset() Script for reset events on the window.
onresize() Script for window resizing.
onscroll() Script for window scrolling.
onselect() Script for window selection.
onsubmit() Script for submits on window forms.
onunload() Script for unload events on the window.
onuserproximity() Script for user proximity events
onpageshow() Script for pageshow events on the window.
onpagehide() Script for pagehide events on the window.
onvisibilitychange(v) Script to run if the screen is shown or hidden. Returns True or False.