javascript的系统了解/通过window属性入手

JS在网页中的宿主是浏览器;

浏览器中window是顶级作用域;

以前在研究JS中类的概念时候也有看;

但是没有逐个属性的查看;

今天输出来,逐个看下,查漏补缺;

JS代码如下

var windowKeyAry=[];//用于储存window上的属性/方法
for (key in window){
windowKeyAry.push(key);//把便利到的key push 到数组里;
}
windowKeyAry.sort(function (a, b) {return a.localeCompare(b);});//排序

console.log(windowKeyAry.length);//查看当前浏览器window属性的数量 注:不同浏览器,或者同一浏览器的不同版本中数量不一致
document.write(windowKeyAry);

下面是看不同浏览器中的表现了;

Chrome:197个属性(我用的Chrome版本 60.0.3112.101(正式版本) (64 位),不同的版本属性可能会有不同的出入)

这里window的属性如下:(为了方便查看,我做了整理)

var addEventListener,
alert,
applicationCache,
atob,
blur,
btoa,
caches,
cancelAnimationFrame,
cancelIdleCallback,
captureEvents,
chrome,
clearInterval,
clearTimeout,
clientInformation,
close,
closed,
confirm,
createImageBitmap,
crypto,
customElements,
defaultstatus,
defaultStatus,
devicePixelRatio,
dispatchEvent,
document,
external,
fetch,
find,
focus,
frameElement,
frames,
getComputedStyle,
getMatchedCSSRules,
getSelection,
history,
indexedDB,
innerHeight,
innerWidth,
isSecureContext,
length,
localStorage,
location,
locationbar,
matchMedia,
menubar,
moveBy,
moveTo,
name,
navigator,
onabort,
onanimationend,
onanimationiteration,
onanimationstart,
onauxclick,
onbeforeunload,
onblur,
oncancel,
oncanplay,
oncanplaythrough,
onchange,
onclick,
onclose,
oncontextmenu,
oncuechange,
ondblclick,
ondevicemotion,
ondeviceorientation,
ondeviceorientationabsolute,
ondrag,
ondragend,
ondragenter,
ondragleave,
ondragover,
ondragstart,
ondrop,
ondurationchange,
onemptied,
onended,
onerror,
onfocus,
ongotpointercapture,
onhashchange,
oninput,
oninvalid,
onkeydown,
onkeypress,
onkeyup,
onlanguagechange,
onload,
onloadeddata,
onloadedmetadata,
onloadstart,
onlostpointercapture,
onmessage,
onmessageerror,
onmousedown,
onmouseenter,
onmouseleave,
onmousemove,
onmouseout,
onmouseover,
onmouseup,
onmousewheel,
onoffline,
ononline,
onpagehide,
onpageshow,
onpause,
onplay,
onplaying,
onpointercancel,
onpointerdown,
onpointerenter,
onpointerleave,
onpointermove,
onpointerout,
onpointerover,
onpointerup,
onpopstate,
onprogress,
onratechange,
onrejectionhandled,
onreset,
onresize,
onscroll,
onsearch,
onseeked,
onseeking,
onselect,
onshow,
onstalled,
onstorage,
onsubmit,
onsuspend,
ontimeupdate,
ontoggle,
ontransitionend,
onunhandledrejection,
onunload,
onvolumechange,
onwaiting,
onwebkitanimationend,
onwebkitanimationiteration,
onwebkitanimationstart,
onwebkittransitionend,
onwheel,
open,
openDatabase,
opener,
origin,
outerHeight,
outerWidth,
pageXOffset,
pageYOffset,
parent,
performance,
PERSISTENT,
personalbar,
postMessage,
print,
prompt,
releaseEvents,
removeEventListener,
requestAnimationFrame,
requestIdleCallback,
resizeBy,
resizeTo,
screen,
screenLeft,
screenTop,
screenX,
screenY,
scroll,
scrollbars,
scrollBy,
scrollTo,
scrollX,
scrollY,
self,
sessionStorage,
setInterval,
setTimeout,
speechSynthesis,
status,
statusbar,
stop,
styleMedia,
TEMPORARY,
toolbar,
top,
webkitCancelAnimationFrame,
webkitRequestAnimationFrame,
webkitRequestFileSystem,
webkitResolveLocalFileSystemURL,
webkitStorageInfo,
window,
windowKeyAry = null;

Firefox :191(我用的火狐版本是54.0.1 (32 位))

下面是火狐的window下属性(为了方便查看,整理如下)

var addEventListener,
alert,
applicationCache,
atob,
blur,
btoa,
caches,
cancelAnimationFrame,
captureEvents,
clearInterval,
clearTimeout,
close,
closed,
confirm,
content,
createImageBitmap,
crypto,
devicePixelRatio,
dispatchEvent,
document,
dump,
external,
fetch,
find,
focus,
frameElement,
frames,
fullScreen,
getComputedStyle,
getDefaultComputedStyle,
getSelection,
history,
indexedDB,
innerHeight,
innerWidth,
InstallTrigger,
isSecureContext,
length,
localStorage,
location,
locationbar,
matchMedia,
menubar,
moveBy,
moveTo,
mozInnerScreenX,
mozInnerScreenY,
mozPaintCount,
name,
navigator,
onabort,
onabsolutedeviceorientation,
onafterprint,
onanimationcancel,
onanimationend,
onanimationiteration,
onanimationstart,
onauxclick,
onbeforeprint,
onbeforeunload,
onblur,
oncanplay,
oncanplaythrough,
onchange,
onclick,
onclose,
oncontextmenu,
ondblclick,
ondevicelight,
ondevicemotion,
ondeviceorientation,
ondeviceproximity,
ondrag,
ondragend,
ondragenter,
ondragexit,
ondragleave,
ondragover,
ondragstart,
ondrop,
ondurationchange,
onemptied,
onended,
onerror,
onfocus,
onhashchange,
oninput,
oninvalid,
onkeydown,
onkeypress,
onkeyup,
onlanguagechange,
onload,
onloadeddata,
onloadedmetadata,
onloadend,
onloadstart,
onmessage,
onmousedown,
onmouseenter,
onmouseleave,
onmousemove,
onmouseout,
onmouseover,
onmouseup,
onmozfullscreenchange,
onmozfullscreenerror,
onoffline,
ononline,
onpagehide,
onpageshow,
onpause,
onplay,
onplaying,
onpopstate,
onprogress,
onratechange,
onreset,
onresize,
onscroll,
onseeked,
onseeking,
onselect,
onselectstart,
onshow,
onstalled,
onstorage,
onsubmit,
onsuspend,
ontimeupdate,
ontoggle,
ontransitioncancel,
ontransitionend,
ontransitionrun,
ontransitionstart,
onunload,
onuserproximity,
onvolumechange,
onwaiting,
onwebkitanimationend,
onwebkitanimationiteration,
onwebkitanimationstart,
onwebkittransitionend,
onwheel,
open,
opener,
origin,
outerHeight,
outerWidth,
pageXOffset,
pageYOffset,
parent,
performance,
personalbar,
postMessage,
print,
prompt,
releaseEvents,
removeEventListener,
requestAnimationFrame,
resizeBy,
resizeTo,
screen,
screenX,
screenY,
scroll,
scrollbars,
scrollBy,
scrollByLines,
scrollByPages,
scrollMaxX,
scrollMaxY,
scrollTo,
scrollX,
scrollY,
self,
sessionStorage,
setInterval,
setResizable,
setTimeout,
sidebar,
sizeToContent,
speechSynthesis,
status,
statusbar,
stop,
toolbar,
top,
updateCommands,
window,
windowKeyAry;

************************************下面是IE的***********************

用的版本是:IE11.0.9600.18638这个版本;下面的数据均是在IE11里,通过模拟的模式得到的数据

Edge:194个;

IE10:182个

IE9:148个

IE8:47个

IE7:47个

————————————————————————-

IE8的数据(47个

var __BROWSERTOOLS_CONSOLE,
__BROWSERTOOLS_CONSOLE_BREAKMODE_FUNC,
__BROWSERTOOLS_DEBUGGER,
__BROWSERTOOLS_DOMEXPLORER_ADDED,
__BROWSERTOOLS_EMULATIONTOOLS_ADDED,
clientInformation,
clipboardData,
closed,
console,
defaultStatus,
document,
event,
external,
frameElement,
frames,
history,
length,
localStorage,
location,
maxConnectionsPerServer,
name,
navigator,
offscreenBuffering,
onafterprint,
onbeforeprint,
onbeforeunload,
onblur,
onerror,
onfocus,
onhashchange,
onhelp,onload,
onmessage,
onresize,
onscroll,
onunload,
opener,
parent,
performance,
screen,
screenLeft,
screenTop,
self,
sessionStorage,
status,
top,
window;

IE9的数据 148个)

var __BROWSERTOOLS_CONSOLE,
__BROWSERTOOLS_CONSOLE_BREAKMODE_FUNC,
__BROWSERTOOLS_CONSOLE_SAFEFUNC,
__BROWSERTOOLS_DEBUGGER,
__BROWSERTOOLS_DOMEXPLORER_ADDED,
__BROWSERTOOLS_EMULATIONTOOLS_ADDED,
addEventListener,
alert,
attachEvent,
blur,
clearInterval,
clearTimeout,
clientInformation,
clipboardData,
close,
closed,
confirm,
console,
createPopup,
defaultStatus,
detachEvent,
dispatchEvent,
document,
event,
execScript,
external,
focus,
frameElement,
frames,
getComputedStyle,
getSelection,
history,
innerHeight,
innerWidth,
item,
length,
localStorage,
location,
maxConnectionsPerServer,
moveBy,
moveTo,
msWriteProfilerMark,
name,
navigate,
navigator,
offscreenBuffering,
onabort,
onafterprint,
onbeforeprint,
onbeforeunload,
onblur,
oncanplay,
oncanplaythrough,
onchange,
onclick,
oncontextmenu,
ondblclick,
ondrag,
ondragend,
ondragenter,
ondragleave,
ondragover,
ondragstart,
ondrop,
ondurationchange,
onemptied,
onended,
onerror,
onfocus,
onfocusin,
onfocusout,
onhashchange,
onhelp,
oninput,
onkeydown,
onkeypress,
onkeyup,
onload,
onloadeddata,
onloadedmetadata,
onloadstart,
onmessage,
onmousedown,
onmouseenter,
onmouseleave,
onmousemove,
onmouseout,
onmouseover,
onmouseup,
onmousewheel,
onoffline,
ononline,
onpause,
onplay,
onplaying,
onprogress,
onratechange,
onreadystatechange,
onreset,
onresize,
onscroll,
onseeked,
onseeking,
onselect,
onstalled,
onstorage,
onsubmit,
onsuspend,
ontimeupdate,
onunload,
onvolumechange,
onwaiting,
open,
opener,
outerHeight,
outerWidth,
pageXOffset,
pageYOffset,
parent,
performance,
postMessage,
print,
prompt,
removeEventListener,
resizeBy,
resizeTo,
screen,
screenLeft,
screenTop,
screenX,
screenY,
scroll,
scrollBy,
scrollTo,
self,
sessionStorage,
setInterval,
setTimeout,
showHelp,
showModalDialog,
showModelessDialog,
status,
styleMedia, top,
toStaticHTML,
toString,
window,
windowKeyAry;

IE10(182个)

var __BROWSERTOOLS_CONSOLE,
__BROWSERTOOLS_CONSOLE_BREAKMODE_FUNC,
__BROWSERTOOLS_CONSOLE_SAFEFUNC,
__BROWSERTOOLS_DEBUGGER,
__BROWSERTOOLS_DOMEXPLORER_ADDED,
__BROWSERTOOLS_EMULATIONTOOLS_ADDED,
__BROWSERTOOLS_MEMORYANALYZER_ADDED,
addEventListener,
alert,
animationStartTime,
applicationCache,
atob,
attachEvent,
blur,
btoa,
cancelAnimationFrame,
clearImmediate,
clearInterval,
clearTimeout,
clientInformation,
clipboardData,
close,
closed,
confirm,
console,
createPopup,
defaultStatus,
detachEvent,
dispatchEvent,
document,
event,
execScript,
external,
focus,
frameElement,
frames,
getComputedStyle,
getSelection,
history,
indexedDB,
innerHeight,
innerWidth,
item,
length,
localStorage,
location,
matchMedia,
maxConnectionsPerServer,
moveBy,
moveTo,
msAnimationStartTime,
msCancelRequestAnimationFrame,
msClearImmediate,
msIndexedDB,
msIsStaticHTML,
msMatchMedia,
msRequestAnimationFrame,
msSetImmediate,
msWriteProfilerMark,
name,
navigate,
navigator,
offscreenBuffering,
onabort,
onafterprint,
onbeforeprint,
onbeforeunload,
onblur,
oncanplay,
oncanplaythrough,
onchange,
onclick,
oncontextmenu,
ondblclick,
ondrag,
ondragend,
ondragenter,
ondragleave,
ondragover,
ondragstart,
ondrop,
ondurationchange,
onemptied,
onended,
onerror,
onfocus,
onfocusin,
onfocusout,
onhashchange,
onhelp,
oninput,
onkeydown,
onkeypress,
onkeyup,
onload,
onloadeddata,
onloadedmetadata,
onloadstart,
onmessage,
onmousedown,
onmouseenter,
onmouseleave,
onmousemove,
onmouseout,
onmouseover,
onmouseup,
onmousewheel,
onmsgesturechange,
onmsgesturedoubletap,
onmsgestureend,
onmsgesturehold,
onmsgesturestart,
onmsgesturetap,
onmsinertiastart,
onmspointercancel,
onmspointerdown,
onmspointerhover,
onmspointermove,
onmspointerout,
onmspointerover,
onmspointerup,
onoffline,
ononline,
onpause,
onplay,
onplaying,
onpopstate,
onprogress,
onratechange,
onreadystatechange,
onreset,
onresize,
onscroll,
onseeked,
onseeking,
onselect,
onstalled,
onstorage,
onsubmit,
onsuspend,
ontimeupdate,
onunload,
onvolumechange,
onwaiting,
open,
opener,
outerHeight,
outerWidth,
pageXOffset,
pageYOffset,
parent,
performance,
postMessage,
print,
prompt,
removeEventListener,
requestAnimationFrame,
resizeBy,
resizeTo,
screen,
screenLeft,
screenTop,
screenX, screenY,
scroll,
scrollBy,
scrollTo,
self,
sessionStorage,
setImmediate,
setInterval,
setTimeout,
showHelp,
showModalDialog,
showModelessDialog,
status,
styleMedia,
top,
toStaticHTML,
toString,
window,
windowKeyAry;

Edge(194个):

var __BROWSERTOOLS_CONSOLE,
__BROWSERTOOLS_CONSOLE_BREAKMODE_FUNC,
__BROWSERTOOLS_CONSOLE_SAFEFUNC,
__BROWSERTOOLS_DEBUGGER,
__BROWSERTOOLS_DOMEXPLORER_ADDED,
__BROWSERTOOLS_EMULATIONTOOLS_ADDED,
__BROWSERTOOLS_MEMORYANALYZER_ADDED,
addEventListener,
alert,
animationStartTime,
applicationCache,
atob,
blur,
btoa,
cancelAnimationFrame,
captureEvents,
clearImmediate,
clearInterval,
clearTimeout,
clientInformation,
clipboardData,
close,
closed,
confirm,
console,
defaultStatus,
devicePixelRatio,
dispatchEvent,
document,
doNotTrack,
event,
external,
focus,
frameElement,
frames,
getComputedStyle,
getSelection,
history,
indexedDB,
innerHeight,
innerWidth,
item,
length,
localStorage,
location,
matchMedia,
maxConnectionsPerServer,
moveBy,
moveTo,
msAnimationStartTime,
msCancelRequestAnimationFrame,
msClearImmediate,
msCrypto,
msIndexedDB,
msIsStaticHTML,
msMatchMedia,
msRequestAnimationFrame,
msSetImmediate,
msWriteProfilerMark,
name,
navigate,
navigator,
offscreenBuffering,
onabort,
onafterprint,
onbeforeprint,
onbeforeunload,
onblur,
oncanplay,
oncanplaythrough,
onchange,
onclick,
oncontextmenu,
ondblclick,
ondrag,
ondragend,
ondragenter,
ondragleave,
ondragover,
ondragstart,
ondrop,
ondurationchange,
onemptied,
onended,
onerror,
onfocus,
onfocusin,
onfocusout,
onhashchange,
onhelp,
oninput,
onkeydown,
onkeypress,
onkeyup,
onload,
onloadeddata,
onloadedmetadata,
onloadstart,
onmessage,
onmousedown,
onmouseenter,
onmouseleave,
onmousemove,
onmouseout,
onmouseover,
onmouseup,
onmousewheel,
onmsgesturechange,
onmsgesturedoubletap,
onmsgestureend,
onmsgesturehold,
onmsgesturestart,
onmsgesturetap,
onmsinertiastart,
onmspointercancel,
onmspointerdown,
onmspointerenter,
onmspointerleave,
onmspointermove,
onmspointerout,
onmspointerover,
onmspointerup,
onoffline,
ononline,
onpagehide,
onpageshow,
onpause,
onplay,
onplaying,
onpointercancel,
onpointerdown,
onpointerenter,
onpointerleave,
onpointermove,
onpointerout,
onpointerover,
onpointerup,
onpopstate,
onprogress,
onratechange,
onreadystatechange,
onreset,
onresize,
onscroll,
onseeked,
onseeking,
onselect,
onstalled,
onstorage,
onsubmit,
onsuspend,
ontimeupdate,
onunload,
onvolumechange,
onwaiting,
open,
opener,
outerHeight,
outerWidth,
pageXOffset,
pageYOffset,
parent,
performance,
postMessage,
print,
prompt,
releaseEvents,
removeEventListener,
requestAnimationFrame,
resizeBy,
resizeTo,
screen,
screenLeft,
screenTop,
screenX,
screenY,
scroll,
scrollBy,
scrollTo,
self,
sessionStorage,
setImmediate,
setInterval,
setTimeout,
showHelp,
showModalDialog,
showModelessDialog,
status,
styleMedia,
top,
toStaticHTML,
toString,
window,
windowKeyAry;

然后就是分析各个属性了;

~~~~~

未经允许不得转载:朱邦邦的WEB前端开发博客 » javascript的系统了解/通过window属性入手

赞 (0)

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址