当前位置: 首页 > Web前端 > HTML

javascriptbom

时间:2023-04-02 15:21:48 HTML

javascriptcontains(ecmascript"es3,5,6")bomdomBom是一个浏览器对象,完整的拼写是BrowserObjectModelBom包含什么window包含以下导航器位置historyscreendocumentopenwindow:window.open("wangyedizhi","-blank/-self");//要打开的url地址//目标新窗口位置_blank(默认)_self(链接到新页面)关闭窗口:window.close();只能关闭从网页打开的页面系统对话框alert()//系统弹窗confirm()//确认和取消弹窗prompt()//弹出可以输入文字的对话框TimersetIitervalTimerclearclearIntervalIndirectsetTimeout同上clearTimeoutnavigatornavigator对象:包含了很多关于网页浏览的浏览器信息,对检测浏览器和操作系统非常有用window.navigator.appCodeName//浏览器代号window.navigator.appName//浏览器程序名window.navigator.appMinorVersion//返回浏览器的次要版本。window.navigator.cpuClass//cpu类型x86window.navigator.platform//操作系统类型win32window.navigator.pluginswindow.navigator.opsProfilewindow.navigator.userProfilewindow.navigator.systemLanguage//客户系统语言zh-cn简体中文locationobject:object包含有关当前URL的信息,也可以通过window.locationlocation.replace()重新加载当前文档location.href//当前加载页面的完整URLlocation.search//设置或返回以a开头的查询问号(?)URL(查询部分)location.host//服务器名称location.pathname//URL设置或返回当前URL的路径部分,如/pictures/index.htmllocation.hash//设置或返回URL(锚点)起始于井号(#),比如#ab'cwindow.onhashchange=function(){}当哈希值改变时location.reload(true|false);//重新加载当前页面,如果为false,则从浏览器缓存中重新加载,为true时,从服务器端重新加载,默认为falsedocument.location.reload(URL)//打开一个新的网页screenwindow。screen.width//屏幕宽度window.screen.height//屏幕高度window.screen.availWidth//可用宽度(去掉任务栏高度)window.screen.availHeight//可用高度(去掉任务栏高度)historyhistory.back()//在浏览历史中后退一步history.forward()//在浏览历史中前进history.go(i)//转到详细历史的第i个html5中的历史registryform:pushState("","","",)//第一个空:data第三个空:地址栏history.window.onpopstatedocumentdocument.write()//向文档写入HTML表达式或JavaScript代码