-
Notifications
You must be signed in to change notification settings - Fork 10
window.external object?
djunny edited this page Jan 14, 2014
·
4 revisions
window.external is native object, it has property:
<script>
window.external = {
// minimize the window
windowMin : function(){},
// maximize the window
windowMax : function(){},
// quit application
windowClose : function(){},
// move the window
// bind element "onmouse" event, and
windowMove : function(){},
// set window border Color
// WDApp right and bottom has 1px border
// it can use mouse to resize winodw
windowColor : function(htmlColor){},
// resize the window
// width(int) = window width
// height(int) = width height
// inScreenCenter(bool) = realign window center
windowResize : function(width,height,inScreenCenter){}
}
</script>
base html:
<html>
<head>
<meta charset="utf-8" />
<title>
WDApp
</title>
</head>
<body>
<div id="action" style="margin:0 auto;padding:50px;background:#000;color:#FFF">Test Event</div>
</body>
</html>
minimize the window:
<script>
document.getElementById('action').onclick = function(){
window.external.windowMin();
}
</script>
maximize or restore the window:
<script>
document.getElementById('action').onclick = function(){
window.external.windowMax();
}
</script>
move window like click native window's caption bar:
<script>
document.getElementById('action').onmousedown = function(){
window.external.windowMove();
}
</script>
resize window:
<script>
document.getElementById('action').onclick = function(){
//set window position at screen center after resize
window.external.windowResize(500, 600, true);
}
</script>
quit application:
<script>
document.getElementById('action').onclick = function(){
window.external.windowClose();
}
</script>
P.S. close Children Window, plz use window.close();