{"id":378,"date":"2020-02-04T23:29:25","date_gmt":"2020-02-04T15:29:25","guid":{"rendered":"https:\/\/blog.cqdefxxx.com\/?p=378"},"modified":"2020-02-04T23:29:25","modified_gmt":"2020-02-04T15:29:25","slug":"bom","status":"publish","type":"post","link":"https:\/\/blog.viter.top\/index.php\/2020\/02\/04\/bom\/","title":{"rendered":"BOM"},"content":{"rendered":"<pre class=\"pure-highlightjs\"><code class=\"\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;meta charset=\"utf-8\" \/&gt;\n\t\t&lt;title&gt;&lt;\/title&gt;\n\t\t&lt;script type=\"text\/javascript\"&gt;\n\t\t\t\/*\n\t\t\t * BOM\n\t\t\t * \t- \u6d4f\u89c8\u5668\u5bf9\u8c61\u6a21\u578b\n\t\t\t * \t- BOM\u53ef\u4ee5\u4f7f\u6211\u4eec\u901a\u8fc7JS\u6765\u64cd\u4f5c\u6d4f\u89c8\u5668\n\t\t\t * \t- \u5728BOM\u4e2d\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u7ec4\u5bf9\u8c61\uff0c\u7528\u6765\u5b8c\u6210\u5bf9\u6d4f\u89c8\u5668\u7684\u64cd\u4f5c\n\t\t\t * \t- BOM\u5bf9\u8c61\n\t\t\t * \t\tWindow\n\t\t\t * \t\t\t- \u4ee3\u8868\u7684\u662f\u6574\u4e2a\u6d4f\u89c8\u5668\u7684\u7a97\u53e3\uff0c\u540c\u65f6window\u4e5f\u662f\u7f51\u9875\u4e2d\u7684\u5168\u5c40\u5bf9\u8c61\n\t\t\t * \t\tNavigator\n\t\t\t * \t\t\t- \u4ee3\u8868\u7684\u5f53\u524d\u6d4f\u89c8\u5668\u7684\u4fe1\u606f\uff0c\u901a\u8fc7\u8be5\u5bf9\u8c61\u53ef\u4ee5\u6765\u8bc6\u522b\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\n\t\t\t * \t\tLocation\n\t\t\t * \t\t\t- \u4ee3\u8868\u5f53\u524d\u6d4f\u89c8\u5668\u7684\u5730\u5740\u680f\u4fe1\u606f\uff0c\u901a\u8fc7Location\u53ef\u4ee5\u83b7\u53d6\u5730\u5740\u680f\u4fe1\u606f\uff0c\u6216\u8005\u64cd\u4f5c\u6d4f\u89c8\u5668\u8df3\u8f6c\u9875\u9762\n\t\t\t * \t\tHistory\n\t\t\t * \t\t\t- \u4ee3\u8868\u6d4f\u89c8\u5668\u7684\u5386\u53f2\u8bb0\u5f55\uff0c\u53ef\u4ee5\u901a\u8fc7\u8be5\u5bf9\u8c61\u6765\u64cd\u4f5c\u6d4f\u89c8\u5668\u7684\u5386\u53f2\u8bb0\u5f55\n\t\t\t * \t\t\t\t\u7531\u4e8e\u9690\u79c1\u539f\u56e0\uff0c\u8be5\u5bf9\u8c61\u4e0d\u80fd\u83b7\u53d6\u5230\u5177\u4f53\u7684\u5386\u53f2\u8bb0\u5f55\uff0c\u53ea\u80fd\u64cd\u4f5c\u6d4f\u89c8\u5668\u5411\u524d\u6216\u5411\u540e\u7ffb\u9875\n\t\t\t * \t\t\t\t\u800c\u4e14\u8be5\u64cd\u4f5c\u53ea\u5728\u5f53\u6b21\u8bbf\u95ee\u65f6\u6709\u6548\n\t\t\t * \t\tScreen\n\t\t\t * \t\t\t- \u4ee3\u8868\u7528\u6237\u7684\u5c4f\u5e55\u7684\u4fe1\u606f\uff0c\u901a\u8fc7\u8be5\u5bf9\u8c61\u53ef\u4ee5\u83b7\u53d6\u5230\u7528\u6237\u7684\u663e\u793a\u5668\u7684\u76f8\u5173\u7684\u4fe1\u606f\n\t\t\t * \n\t\t\t * \n\t\t\t * \t\t\u8fd9\u4e9bBOM\u5bf9\u8c61\u5728\u6d4f\u89c8\u5668\u4e2d\u90fd\u662f\u4f5c\u4e3awindow\u5bf9\u8c61\u7684\u5c5e\u6027\u4fdd\u5b58\u7684\uff0c\n\t\t\t * \t\t\t\u53ef\u4ee5\u901a\u8fc7window\u5bf9\u8c61\u6765\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\n\t\t\t * \n\t\t\t * \t\t\n\t\t\t *\/\n\t\t\t\n\t\t\t\/\/console.log(navigator);\n\t\t\t\/\/console.log(location);\n\t\t\t\/\/console.log(history);\n\t\t\t\n\t\t\t\/*\n\t\t\t * Navigator\n\t\t\t * \t- \u4ee3\u8868\u7684\u5f53\u524d\u6d4f\u89c8\u5668\u7684\u4fe1\u606f\uff0c\u901a\u8fc7\u8be5\u5bf9\u8c61\u53ef\u4ee5\u6765\u8bc6\u522b\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\n\t\t\t * \t- \u7531\u4e8e\u5386\u53f2\u539f\u56e0\uff0cNavigator\u5bf9\u8c61\u4e2d\u7684\u5927\u90e8\u5206\u5c5e\u6027\u90fd\u5df2\u7ecf\u4e0d\u80fd\u5e2e\u52a9\u6211\u4eec\u8bc6\u522b\u6d4f\u89c8\u5668\u4e86\n\t\t\t * \t- \u4e00\u822c\u6211\u4eec\u53ea\u4f1a\u4f7f\u7528userAgent\u6765\u5224\u65ad\u6d4f\u89c8\u5668\u7684\u4fe1\u606f\uff0c\n\t\t\t * \t\tuserAgent\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8fd9\u4e2a\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u6709\u7528\u6765\u63cf\u8ff0\u6d4f\u89c8\u5668\u4fe1\u606f\u7684\u5185\u5bb9\uff0c\n\t\t\t * \t\t\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\u4f1a\u6709\u4e0d\u540c\u7684userAgent\n\t\t\t * \n\t\t\t * \u706b\u72d0\u7684userAgent\n\t\t\t * \tMozilla\/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko\/20100101 Firefox\/50.0\n\t\t\t * \n\t\t\t * Chrome\u7684userAgent\n\t\t\t *  Mozilla\/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/52.0.2743.82 Safari\/537.36\n\t\t\t * \n\t\t\t * IE8\n\t\t\t * \tMozilla\/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident\/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)\n\t\t\t * \n\t\t\t * IE9\n\t\t\t * \tMozilla\/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident\/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)\n\t\t\t * \n\t\t\t * IE10\n\t\t\t * \tMozilla\/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident\/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)\n\t\t\t * \n\t\t\t * IE11\n\t\t\t * \tMozilla\/5.0 (Windows NT 6.1; WOW64; Trident\/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; rv:11.0) like Gecko\n\t\t\t * \t- \u5728IE11\u4e2d\u5df2\u7ecf\u5c06\u5fae\u8f6f\u548cIE\u76f8\u5173\u7684\u6807\u8bc6\u90fd\u5df2\u7ecf\u53bb\u9664\u4e86\uff0c\u6240\u4ee5\u6211\u4eec\u57fa\u672c\u5df2\u7ecf\u4e0d\u80fd\u901a\u8fc7UserAgent\u6765\u8bc6\u522b\u4e00\u4e2a\u6d4f\u89c8\u5668\u662f\u5426\u662fIE\u4e86\n\t\t\t *\/\n\t\t\t\n\t\t\t\/\/alert(navigator.appName);\n\t\t\t\n\t\t\tvar ua = navigator.userAgent;\n\t\t\t\n\t\t\tconsole.log(ua);\n\t\t\t\n\t\t\tif(\/firefox\/i.test(ua)){\n\t\t\t\talert(\"\u4f60\u662f\u706b\u72d0\uff01\uff01\uff01\");\n\t\t\t}else if(\/chrome\/i.test(ua)){\n\t\t\t\talert(\"\u4f60\u662fChrome\");\n\t\t\t}else if(\/msie\/i.test(ua)){\n\t\t\t\talert(\"\u4f60\u662fIE\u6d4f\u89c8\u5668~~~\");\n\t\t\t}else if(\"ActiveXObject\" in window){\n\t\t\t\talert(\"\u4f60\u662fIE11\uff0c\u67aa\u6bd9\u4e86\u4f60~~~\");\n\t\t\t}\n\t\t\t\n\t\t\t\/*\n\t\t\t * \u5982\u679c\u901a\u8fc7UserAgent\u4e0d\u80fd\u5224\u65ad\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e9b\u6d4f\u89c8\u5668\u4e2d\u7279\u6709\u7684\u5bf9\u8c61\uff0c\u6765\u5224\u65ad\u6d4f\u89c8\u5668\u7684\u4fe1\u606f\n\t\t\t * \u6bd4\u5982\uff1aActiveXObject\n\t\t\t *\/\n\t\t\t\/*if(\"ActiveXObject\" in window){\n\t\t\t\talert(\"\u4f60\u662fIE\uff0c\u6211\u5df2\u7ecf\u6293\u4f4f\u4f60\u4e86~~~\");\n\t\t\t}else{\n\t\t\t\talert(\"\u4f60\u4e0d\u662fIE~~~\");\n\t\t\t}*\/\n\t\t\t\n\t\t\t\/*alert(\"ActiveXObject\" in window);*\/\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t&lt;\/script&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;\n\t\t\n\t&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h1>History<\/h1>\n<pre class=\"pure-highlightjs\"><code class=\"\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;meta charset=\"UTF-8\"&gt;\n\t\t&lt;title&gt;&lt;\/title&gt;\n\t\t&lt;script type=\"text\/javascript\"&gt;\n\t\t\t\/*\n\t\t\t * History\n\t\t\t * \t- \u5bf9\u8c61\u53ef\u4ee5\u7528\u6765\u64cd\u4f5c\u6d4f\u89c8\u5668\u5411\u524d\u6216\u5411\u540e\u7ffb\u9875\n\t\t\t *\/\n\t\t\twindow.onload = function(){\n\t\t\t\t\n\t\t\t\t\/\/\u83b7\u53d6\u6309\u94ae\u5bf9\u8c61\n\t\t\t\tvar btn = document.getElementById(\"btn\");\n\t\t\t\t\n\t\t\t\tbtn.onclick = function(){\n\t\t\t\t\t\/*\n\t\t\t\t\t * length\n\t\t\t\t\t * \t- \u5c5e\u6027\uff0c\u53ef\u4ee5\u83b7\u53d6\u5230\u5f53\u6210\u8bbf\u95ee\u7684\u94fe\u63a5\u6570\u91cf\n\t\t\t\t\t *\/\n\t\t\t\t\t\/\/alert(history.length);\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * back()\n\t\t\t\t\t * \t- \u53ef\u4ee5\u7528\u6765\u56de\u9000\u5230\u4e0a\u4e00\u4e2a\u9875\u9762\uff0c\u4f5c\u7528\u548c\u6d4f\u89c8\u5668\u7684\u56de\u9000\u6309\u94ae\u4e00\u6837\n\t\t\t\t\t *\/\n\t\t\t\t\t\/\/history.back();\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * forward()\n\t\t\t\t\t * \t- \u53ef\u4ee5\u8df3\u8f6c\u4e0b\u4e00\u4e2a\u9875\u9762\uff0c\u4f5c\u7528\u548c\u6d4f\u89c8\u5668\u7684\u524d\u8fdb\u6309\u94ae\u4e00\u6837\n\t\t\t\t\t *\/\n\t\t\t\t\t\/\/history.forward();\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * go()\n\t\t\t\t\t * \t- \u53ef\u4ee5\u7528\u6765\u8df3\u8f6c\u5230\u6307\u5b9a\u7684\u9875\u9762\n\t\t\t\t\t * \t- \u5b83\u9700\u8981\u4e00\u4e2a\u6574\u6570\u4f5c\u4e3a\u53c2\u6570\n\t\t\t\t\t * \t\t1:\u8868\u793a\u5411\u524d\u8df3\u8f6c\u4e00\u4e2a\u9875\u9762 \u76f8\u5f53\u4e8eforward()\n\t\t\t\t\t * \t\t2:\u8868\u793a\u5411\u524d\u8df3\u8f6c\u4e24\u4e2a\u9875\u9762\n\t\t\t\t\t * \t\t-1:\u8868\u793a\u5411\u540e\u8df3\u8f6c\u4e00\u4e2a\u9875\u9762\n\t\t\t\t\t * \t\t-2:\u8868\u793a\u5411\u540e\u8df3\u8f6c\u4e24\u4e2a\u9875\u9762\n\t\t\t\t\t *\/\n\t\t\t\t\thistory.go(-2);\n\t\t\t\t};\n\t\t\t\t\n\t\t\t};\n\t\t\t\n\t\t&lt;\/script&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;\n\t\t\n\t\t&lt;button id=\"btn\"&gt;\u70b9\u6211\u4e00\u4e0b&lt;\/button&gt;\n\t\t\n\t\t&lt;h1&gt;History&lt;\/h1&gt;\n\t\t\n\t\t&lt;a href=\"01.BOM.html\"&gt;\u53bbBOM&lt;\/a&gt;\n\t&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<h1>Location<\/h1>\n<pre class=\"pure-highlightjs\"><code class=\"\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;meta charset=\"UTF-8\"&gt;\n\t\t&lt;title&gt;&lt;\/title&gt;\n\t\t&lt;script type=\"text\/javascript\"&gt;\n\t\t\t\/*\n\t\t\t * Location\n\t\t\t * \t- \u8be5\u5bf9\u8c61\u4e2d\u5c01\u88c5\u4e86\u6d4f\u89c8\u5668\u7684\u5730\u5740\u680f\u7684\u4fe1\u606f\n\t\t\t *\/\n\t\t\twindow.onload = function(){\n\t\t\t\t\n\t\t\t\t\/\/\u83b7\u53d6\u6309\u94ae\u5bf9\u8c61\n\t\t\t\tvar btn = document.getElementById(\"btn\");\n\t\t\t\t\n\t\t\t\tbtn.onclick = function(){\n\t\t\t\t\t\n\t\t\t\t\t\/\/\u5982\u679c\u76f4\u63a5\u6253\u5370location\uff0c\u5219\u53ef\u4ee5\u83b7\u53d6\u5230\u5730\u5740\u680f\u7684\u4fe1\u606f\uff08\u5f53\u524d\u9875\u9762\u7684\u5b8c\u6574\u8def\u5f84\uff09\n\t\t\t\t\t\/\/alert(location);\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * \u5982\u679c\u76f4\u63a5\u5c06location\u5c5e\u6027\u4fee\u6539\u4e3a\u4e00\u4e2a\u5b8c\u6574\u7684\u8def\u5f84\uff0c\u6216\u76f8\u5bf9\u8def\u5f84\n\t\t\t\t\t * \t\u5219\u6211\u4eec\u9875\u9762\u4f1a\u81ea\u52a8\u8df3\u8f6c\u5230\u8be5\u8def\u5f84\uff0c\u5e76\u4e14\u4f1a\u751f\u6210\u76f8\u5e94\u7684\u5386\u53f2\u8bb0\u5f55\n\t\t\t\t\t *\/\n\t\t\t\t\t\/\/location = \"http:\/\/www.baidu.com\";\n\t\t\t\t\t\/\/location = \"01.BOM.html\";\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * assign()\n\t\t\t\t\t * \t- \u7528\u6765\u8df3\u8f6c\u5230\u5176\u4ed6\u7684\u9875\u9762\uff0c\u4f5c\u7528\u548c\u76f4\u63a5\u4fee\u6539location\u4e00\u6837\n\t\t\t\t\t *\/\n\t\t\t\t\t\/\/location.assign(\"http:\/\/www.baidu.com\");\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * reload()\n\t\t\t\t\t * \t- \u7528\u4e8e\u91cd\u65b0\u52a0\u8f7d\u5f53\u524d\u9875\u9762\uff0c\u4f5c\u7528\u548c\u5237\u65b0\u6309\u94ae\u4e00\u6837\n\t\t\t\t\t * \t- \u5982\u679c\u5728\u65b9\u6cd5\u4e2d\u4f20\u9012\u4e00\u4e2atrue\uff0c\u4f5c\u4e3a\u53c2\u6570\uff0c\u5219\u4f1a\u5f3a\u5236\u6e05\u7a7a\u7f13\u5b58\u5237\u65b0\u9875\u9762\n\t\t\t\t\t *\/\n\t\t\t\t\t\/\/location.reload(true);\n\t\t\t\t\t\n\t\t\t\t\t\/*\n\t\t\t\t\t * replace()\n\t\t\t\t\t * \t- \u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u65b0\u7684\u9875\u9762\u66ff\u6362\u5f53\u524d\u9875\u9762\uff0c\u8c03\u7528\u5b8c\u6bd5\u4e5f\u4f1a\u8df3\u8f6c\u9875\u9762\n\t\t\t\t\t * \t\t\u4e0d\u4f1a\u751f\u6210\u5386\u53f2\u8bb0\u5f55\uff0c\u4e0d\u80fd\u4f7f\u7528\u56de\u9000\u6309\u94ae\u56de\u9000\n\t\t\t\t\t *\/\n\t\t\t\t\tlocation.replace(\"01.BOM.html\");\n\t\t\t\t\t\n\t\t\t\t};\n\t\t\t\t\n\t\t\t};\n\t\t\t\n\t\t&lt;\/script&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;\n\t\t\n\t\t&lt;button id=\"btn\"&gt;\u70b9\u6211\u4e00\u4e0b&lt;\/button&gt;\n\t\t\n\t\t&lt;h1&gt;Location&lt;\/h1&gt;\n\t\t\n\t\t&lt;input type=\"text\" \/&gt;\n\t\t&lt;a href=\"01.BOM.html\"&gt;\u53bbBOM&lt;\/a&gt;\n\t&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[4],"_links":{"self":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/378"}],"collection":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/comments?post=378"}],"version-history":[{"count":0,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/378\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/media?parent=378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/categories?post=378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/tags?post=378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}