1:"$Sreact.fragment"
3:I[5244,[],""]
4:I[3866,[],""]
6:I[6213,[],"OutletBoundary"]
8:I[6213,[],"MetadataBoundary"]
a:I[6213,[],"ViewportBoundary"]
c:I[4835,[],""]
:HL["/_next/static/css/2a5e2948171407d9.css","style"]
0:{"P":null,"b":"bPJFpEFk0_gcWt47A57l9","p":"","c":["","frontend","network","browser-cross-origin"],"i":false,"f":[[["",{"children":[["mdxPath","frontend/network/browser-cross-origin","oc"],{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2a5e2948171407d9.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],"$L2"]}],{"children":[["mdxPath","frontend/network/browser-cross-origin","oc"],["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children","$0:f:0:1:2:children:0","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":["$L5",null,["$","$L6",null,{"children":"$L7"}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,["$","$1","sc4McNhkv-4BzmFXDnGeM",{"children":[["$","$L8",null,{"children":"$L9"}],["$","$La",null,{"children":"$Lb"}],null]}]]}],false]],"m":"$undefined","G":["$c","$undefined"],"s":false,"S":true}
d:I[9981,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"ThemeConfigProvider"]
e:I[7751,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"LastUpdated"]
f:I[7308,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","795","static/chunks/795-d777014d77bf3eb1.js","728","static/chunks/728-7c60a700dd3f68c6.js","177","static/chunks/app/layout-40bff8d2cc47ca21.js"],"Search"]
10:I[7113,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","795","static/chunks/795-d777014d77bf3eb1.js","728","static/chunks/728-7c60a700dd3f68c6.js","177","static/chunks/app/layout-40bff8d2cc47ca21.js"],"ThemeProvider"]
11:I[2646,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"SkipNavLink"]
12:I[8069,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"ConfigProvider"]
13:I[8173,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],""]
14:I[4838,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"ClientNavbar"]
16:I[761,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"ThemeSwitch"]
17:I[4431,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"MobileNav"]
18:I[5967,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","795","static/chunks/795-d777014d77bf3eb1.js","728","static/chunks/728-7c60a700dd3f68c6.js","177","static/chunks/app/layout-40bff8d2cc47ca21.js"],"Analytics"]
19:I[2264,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","795","static/chunks/795-d777014d77bf3eb1.js","728","static/chunks/728-7c60a700dd3f68c6.js","177","static/chunks/app/layout-40bff8d2cc47ca21.js"],"SpeedInsights"]
15:T481,M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z2:["$","html",null,{"lang":"en","dir":"ltr","suppressHydrationWarning":true,"children":[["$","head",null,{"children":[[["$","link",null,{"rel":"icon","type":"image/png","href":"/favicons/favicon-96x96.png","sizes":"96x96"}],["$","link",null,{"rel":"icon","type":"image/svg+xml","href":"/favicons/favicon.svg"}],["$","link",null,{"rel":"shortcut icon","href":"/favicons/favicon.ico"}],["$","link",null,{"rel":"apple-touch-icon","sizes":"180x180","href":"/favicons/apple-touch-icon.png"}],["$","link",null,{"rel":"manifest","href":"/favicons/site.webmanifest"}]],["$","style",null,{"children":":root {\n  --nextra-primary-hue: 212deg;\n  --nextra-primary-saturation: 100%;\n  --nextra-primary-lightness: 45%;\n  --nextra-bg: 250,250,250;\n  --nextra-content-width: 90rem;\n}\n.dark {\n  --nextra-primary-hue: 204deg;\n  --nextra-primary-saturation: 100%;\n  --nextra-primary-lightness: 55%;\n  --nextra-bg: 17,17,17;\n}\n::selection {\n  background: hsla(var(--nextra-primary-hue),var(--nextra-primary-saturation),var(--nextra-primary-lightness),.3);\n}\nhtml {\n  background: rgb(var(--nextra-bg));\n}"}],["$","meta",null,{"name":"theme-color","media":"(prefers-color-scheme: light)","content":"rgb(250,250,250)"}],["$","meta",null,{"name":"theme-color","media":"(prefers-color-scheme: dark)","content":"rgb(17,17,17)"}],"$undefined"]}],["$","body",null,{"children":[["$","$Ld",null,{"value":{"darkMode":true,"docsRepositoryBase":"https://github.com/shuding/nextra","editLink":null,"feedback":{"content":null,"labels":"feedback"},"i18n":[],"lastUpdated":["$","$Le",null,{}],"navigation":{"next":true,"prev":true},"search":["$","$Lf",null,{}],"sidebar":{"defaultMenuCollapseLevel":1,"defaultOpen":true,"toggleButton":true},"themeSwitch":{"dark":"Dark","light":"Light","system":"System"},"toc":{"backToTop":"Scroll to top","float":true,"title":"On This Page"}},"children":["$","$L10",null,{"attribute":"class","disableTransitionOnChange":true,"children":[["$","$L11",null,{}],"$undefined",["$","$L12",null,{"pageMap":[{"data":{"index":{"type":"page","title":"Home"},"algorithm":{"type":"page","title":"算法"},"javascript":{"type":"page","title":"JavaScript"},"frontend":{"type":"page","title":"前端"},"OS":{"type":"page","title":"OS"},"misc":{"type":"page","title":"杂项"},"other":{"type":"page","title":"其他"},"links":{"type":"page","title":"Links ↗","theme":{"layout":"full","timestamp":false,"toc":false,"typesetting":"article"}},"*":{"type":"page"}}},{"name":"index","route":"/","frontMatter":{"title":"Index","filePath":"content/index.mdx","timestamp":1740644164000},"title":"Home"},{"name":"algorithm","route":"/algorithm","children":[{"data":{"sort":{"title":"排序"},"search":{"title":"搜索"},"dynamic_programming":{"title":"动态规划"},"tree":{"title":"树"},"lowest-common-ancestor-of-a-binary-tree":{"title":"二叉树最近公共祖先"}}},{"name":"sort","route":"/algorithm/sort","frontMatter":{"title":"Sort","filePath":"content/algorithm/sort.mdx","timestamp":1740644164000},"title":"排序"},{"name":"search","route":"/algorithm/search","frontMatter":{"title":"Search","filePath":"content/algorithm/search.mdx","timestamp":1740644164000},"title":"搜索"},{"name":"dynamic_programming","route":"/algorithm/dynamic_programming","frontMatter":{"title":"Dynamic Programming","filePath":"content/algorithm/dynamic_programming.mdx","timestamp":1740644164000},"title":"动态规划"},{"name":"tree","route":"/algorithm/tree","frontMatter":{"title":"Tree","filePath":"content/algorithm/tree.mdx","timestamp":1740644164000},"title":"树"},{"name":"lowest-common-ancestor-of-a-binary-tree","route":"/algorithm/lowest-common-ancestor-of-a-binary-tree","frontMatter":{"title":"二叉树最近公共祖先","filePath":"content/algorithm/lowest-common-ancestor-of-a-binary-tree.mdx","timestamp":1740644164000},"title":"二叉树最近公共祖先"}],"title":"算法"},{"name":"javascript","route":"/javascript","children":[{"data":{"specification":{"title":"前端JS规范"},"new":{"title":"new操作符的原理"},"typeof":{"title":"数据类型的判断"},"json-parse":{"title":"JSON来回转换的坑"},"call-apply-bind":{"title":"实现 call、apply、bind"},"tagFn":{"title":"标签函数"},"Promise":{"title":"Promise"},"console":{"title":"Console 的使用"},"webworker":{"title":"Web Worker"},"add-params":{"title":"一种简洁的添加入参的方法"},"QA":{"title":"常见JS问题"},"Code":{"title":"常见代码片段","display":"hidden"}}},{"name":"specification","route":"/javascript/specification","frontMatter":{"title":"前端 JS 规范","filePath":"content/javascript/specification.mdx","timestamp":1740644164000},"title":"前端JS规范"},{"name":"new","route":"/javascript/new","frontMatter":{"title":"New","filePath":"content/javascript/new.mdx","timestamp":1740644164000},"title":"new操作符的原理"},{"name":"typeof","route":"/javascript/typeof","frontMatter":{"title":"Typeof","filePath":"content/javascript/typeof.mdx","timestamp":1740644164000},"title":"数据类型的判断"},{"name":"json-parse","route":"/javascript/json-parse","frontMatter":{"title":"Json Parse","filePath":"content/javascript/json-parse.mdx","timestamp":1740644164000},"title":"JSON来回转换的坑"},{"name":"call-apply-bind","route":"/javascript/call-apply-bind","frontMatter":{"title":"Call Apply Bind","filePath":"content/javascript/call-apply-bind.mdx","timestamp":1740644164000},"title":"实现 call、apply、bind"},{"name":"tagFn","route":"/javascript/tagFn","frontMatter":{"title":"Tagfn","filePath":"content/javascript/tagFn.mdx","timestamp":1740644164000},"title":"标签函数"},{"name":"Promise","route":"/javascript/Promise","frontMatter":{"title":"Promise 对象","filePath":"content/javascript/Promise.mdx","timestamp":1740644164000},"title":"Promise"},{"name":"console","route":"/javascript/console","frontMatter":{"title":"Console","filePath":"content/javascript/console.mdx","timestamp":1740644164000},"title":"Console 的使用"},{"name":"webworker","route":"/javascript/webworker","frontMatter":{"title":"Web Worker 的使用限制","filePath":"content/javascript/webworker.mdx","timestamp":1740644164000},"title":"Web Worker"},{"name":"add-params","route":"/javascript/add-params","frontMatter":{"title":"Add Params","filePath":"content/javascript/add-params.mdx","timestamp":1740644164000},"title":"一种简洁的添加入参的方法"},{"name":"QA","route":"/javascript/QA","frontMatter":{"title":"Qa","filePath":"content/javascript/QA.mdx","timestamp":1740644164000},"title":"常见JS问题"},{"name":"Code","route":"/javascript/Code","children":[{"name":"Async-Concurrent","route":"/javascript/Code/Async-Concurrent","frontMatter":{"title":"异步任务并发量","filePath":"content/javascript/Code/Async-Concurrent.md","timestamp":1740644164000},"title":"异步任务并发量"},{"name":"DeepClone","route":"/javascript/Code/DeepClone","frontMatter":{"title":"Deepclone","filePath":"content/javascript/Code/DeepClone.md","timestamp":1740644164000},"title":"Deepclone"},{"name":"Lazyman","route":"/javascript/Code/Lazyman","frontMatter":{"title":"Lazyman","filePath":"content/javascript/Code/Lazyman.md","timestamp":1740644164000},"title":"Lazyman"},{"name":"debounce&throttle","route":"/javascript/Code/debounce&throttle","frontMatter":{"title":"debounce&throttle(防抖与节流)","filePath":"content/javascript/Code/debounce&throttle.md","timestamp":1740644164000},"title":"debounce&throttle(防抖与节流)"},{"name":"deduplication","route":"/javascript/Code/deduplication","frontMatter":{"title":"Deduplication","filePath":"content/javascript/Code/deduplication.md","timestamp":1740644164000},"title":"Deduplication"},{"name":"flatArray","route":"/javascript/Code/flatArray","frontMatter":{"title":"Flatarray","filePath":"content/javascript/Code/flatArray.md","timestamp":1740644164000},"title":"Flatarray"},{"name":"getSum","route":"/javascript/Code/getSum","frontMatter":{"title":"Getsum","filePath":"content/javascript/Code/getSum.md","timestamp":1740644164000},"title":"Getsum"},{"name":"longest-substring","route":"/javascript/Code/longest-substring","frontMatter":{"title":"Longest Substring","filePath":"content/javascript/Code/longest-substring.md","timestamp":1740644164000},"title":"Longest Substring"},{"name":"reverse-linked-list","route":"/javascript/Code/reverse-linked-list","frontMatter":{"title":"反转链表","filePath":"content/javascript/Code/reverse-linked-list.md","timestamp":1740644164000},"title":"反转链表"},{"name":"threeSum","route":"/javascript/Code/threeSum","frontMatter":{"title":"三数之和","filePath":"content/javascript/Code/threeSum.md","timestamp":1740644164000},"title":"三数之和"}],"title":"常见代码片段"},{"name":"eventloop","route":"/javascript/eventloop","frontMatter":{"title":"Eventloop","filePath":"content/javascript/eventloop.mdx","timestamp":1740644164000},"title":"Eventloop"}],"title":"JavaScript"},{"name":"frontend","route":"/frontend","children":[{"name":"Basics","route":"/frontend/Basics","children":[{"data":{"Formatting-Context":{"title":"Formatting Context"},"css-selector":{"title":"css选择器"},"offsetAndSize":{"title":"元素的大小及位置"},"Hide-Element":{"title":"隐藏元素的几种方法"},"center":{"title":"水平垂直居中"},"html-lifeCycle":{"title":"页面的生命周期"},"1px":{"title":"关于 1px 问题"}}},{"name":"Formatting-Context","route":"/frontend/Basics/Formatting-Context","frontMatter":{"title":"Formatting Context","filePath":"content/frontend/Basics/Formatting-Context.md","timestamp":1740644164000},"title":"Formatting Context"},{"name":"css-selector","route":"/frontend/Basics/css-selector","frontMatter":{"title":"CSS 选择器","filePath":"content/frontend/Basics/css-selector.md","timestamp":1740644164000},"title":"css选择器"},{"name":"offsetAndSize","route":"/frontend/Basics/offsetAndSize","frontMatter":{"title":"Offsetandsize","filePath":"content/frontend/Basics/offsetAndSize.md","timestamp":1740644164000},"title":"元素的大小及位置"},{"name":"Hide-Element","route":"/frontend/Basics/Hide-Element","frontMatter":{"title":"Hide Element","filePath":"content/frontend/Basics/Hide-Element.md","timestamp":1740644164000},"title":"隐藏元素的几种方法"},{"name":"center","route":"/frontend/Basics/center","frontMatter":{"title":"Center","filePath":"content/frontend/Basics/center.md","timestamp":1740644164000},"title":"水平垂直居中"},{"name":"html-lifeCycle","route":"/frontend/Basics/html-lifeCycle","frontMatter":{"title":"页面生命周期","filePath":"content/frontend/Basics/html-lifeCycle.mdx","timestamp":1740644164000},"title":"页面的生命周期"},{"name":"1px","route":"/frontend/Basics/1px","frontMatter":{"title":"关于 1px 问题","filePath":"content/frontend/Basics/1px.md","timestamp":1740644164000},"title":"关于 1px 问题"},{"name":"Flex","route":"/frontend/Basics/Flex","frontMatter":{"title":"Flex","filePath":"content/frontend/Basics/Flex.md","timestamp":1740644164000},"title":"Flex"}],"title":"Basics"},{"name":"Code","route":"/frontend/Code","children":[{"data":{"largeText":{"title":"页面大文本崩溃处理"}}},{"name":"largeText","route":"/frontend/Code/largeText","frontMatter":{"title":"页面大文本崩溃处理","filePath":"content/frontend/Code/largeText.mdx","timestamp":1740644164000},"title":"页面大文本崩溃处理"}],"title":"Code"},{"name":"React","route":"/frontend/React","children":[{"data":{"react-old-new":{"title":"React 新老架构"},"fiber":{"title":"Fiber 架构"},"react-lifeCycle":{"title":"React 生命周期"},"React-Strict-Mode":{"title":"React的严格模式"},"React-Performance-Optimization":{"title":"React的性能优化"}}},{"name":"react-old-new","route":"/frontend/React/react-old-new","frontMatter":{"title":"React 新老架构","filePath":"content/frontend/React/react-old-new.mdx","timestamp":1740644164000},"title":"React 新老架构"},{"name":"fiber","route":"/frontend/React/fiber","frontMatter":{"title":"Fiber","filePath":"content/frontend/React/fiber.mdx","timestamp":1740644164000},"title":"Fiber 架构"},{"name":"react-lifeCycle","route":"/frontend/React/react-lifeCycle","frontMatter":{"title":"React Lifecycle","filePath":"content/frontend/React/react-lifeCycle.mdx","timestamp":1740644164000},"title":"React 生命周期"},{"name":"React-Strict-Mode","route":"/frontend/React/React-Strict-Mode","frontMatter":{"title":"React Strict Mode","filePath":"content/frontend/React/React-Strict-Mode.mdx","timestamp":1740644164000},"title":"React的严格模式"},{"name":"React-Performance-Optimization","route":"/frontend/React/React-Performance-Optimization","frontMatter":{"title":"React 的性能优化","filePath":"content/frontend/React/React-Performance-Optimization.mdx","timestamp":1740644164000},"title":"React的性能优化"},{"name":"State-Library","route":"/frontend/React/State-Library","frontMatter":{"title":"React 主流状态管理库","filePath":"content/frontend/React/State-Library.mdx","timestamp":1740644164000},"title":"React 主流状态管理库"}],"title":"React"},{"name":"misc","route":"/frontend/misc","children":[{"data":{"Modularization":{"title":"前端模块化规范"},"DevTools":{"title":"DevTools"},"Performance-Optimization":{"title":"性能优化"},"node-version-manager":{"title":"node 版本管理"},"client-fingerprint":{"title":"客户端指纹"}}},{"name":"Modularization","route":"/frontend/misc/Modularization","frontMatter":{"title":"额外补充","filePath":"content/frontend/misc/Modularization.md","timestamp":1740644164000},"title":"前端模块化规范"},{"name":"DevTools","route":"/frontend/misc/DevTools","frontMatter":{"title":"Devtools","filePath":"content/frontend/misc/DevTools.md","timestamp":1740644164000},"title":"DevTools"},{"name":"Performance-Optimization","route":"/frontend/misc/Performance-Optimization","frontMatter":{"title":"Performance Optimization","filePath":"content/frontend/misc/Performance-Optimization.md","timestamp":1740644164000},"title":"性能优化"},{"name":"node-version-manager","route":"/frontend/misc/node-version-manager","frontMatter":{"title":"Node Version Manager","filePath":"content/frontend/misc/node-version-manager.md","timestamp":1740644164000},"title":"node 版本管理"},{"name":"client-fingerprint","route":"/frontend/misc/client-fingerprint","frontMatter":{"title":"客户端指纹","filePath":"content/frontend/misc/client-fingerprint.mdx","timestamp":1740644164000},"title":"客户端指纹"}],"title":"Misc"},{"name":"network","route":"/frontend/network","children":[{"data":{"http1.1&http2":{"title":"HTTP1.1 & HTTP2"},"http-cache":{"title":"HTTP缓存"},"browser-cross-origin":{"title":"浏览器跨域"}}},{"name":"http1.1&http2","route":"/frontend/network/http1.1&http2","frontMatter":{"title":"Http1.1&http2","filePath":"content/frontend/network/http1.1&http2.mdx","timestamp":1740644164000},"title":"HTTP1.1 & HTTP2"},{"name":"http-cache","route":"/frontend/network/http-cache","frontMatter":{"title":"HTTP Cache","filePath":"content/frontend/network/http-cache.mdx","timestamp":1740644164000},"title":"HTTP缓存"},{"name":"browser-cross-origin","route":"/frontend/network/browser-cross-origin","frontMatter":{"title":"浏览器跨域","filePath":"content/frontend/network/browser-cross-origin.mdx","timestamp":1740644164000},"title":"浏览器跨域"}],"title":"Network"}],"title":"前端"},{"name":"OS","route":"/OS","children":[{"name":"Android","route":"/OS/Android","children":[{"data":{"Android-record":{"title":"记录一些刷机常用的软件"},"Android-Optimize":{"title":"安卓优化"},"SECRET-CODE":{"title":"拨号快捷键"}}},{"name":"Android-record","route":"/OS/Android/Android-record","frontMatter":{"title":"Android Record","filePath":"content/OS/Android/Android-record.mdx","timestamp":1740644164000},"title":"记录一些刷机常用的软件"},{"name":"Android-Optimize","route":"/OS/Android/Android-Optimize","frontMatter":{"title":"Android Optimize","filePath":"content/OS/Android/Android-Optimize.mdx","timestamp":1740644164000},"title":"安卓优化"},{"name":"SECRET-CODE","route":"/OS/Android/SECRET-CODE","frontMatter":{"title":"Secret Code","filePath":"content/OS/Android/SECRET-CODE.mdx","timestamp":1740644164000},"title":"拨号快捷键"},{"name":"adb","route":"/OS/Android/adb","frontMatter":{"title":"Adb","filePath":"content/OS/Android/adb.mdx","timestamp":1740644164000},"title":"Adb"},{"name":"kernelsu-overlayfs","route":"/OS/Android/kernelsu-overlayfs","frontMatter":{"title":"Kernelsu Overlayfs","filePath":"content/OS/Android/kernelsu-overlayfs.mdx","timestamp":1740644164000},"title":"Kernelsu Overlayfs"}],"title":"Android"},{"name":"Global","route":"/OS/Global","children":[{"data":{"IPv6-set":{"title":"IPv6 设置"}}},{"name":"IPv6-set","route":"/OS/Global/IPv6-set","frontMatter":{"title":"Ipv6 Set","filePath":"content/OS/Global/IPv6-set.mdx","timestamp":1740644164000},"title":"IPv6 设置"}],"title":"Global"},{"name":"Linux","route":"/OS/Linux","children":[{"data":{"alpine-openrc":{"title":"Alpine 管理服务"},"sysctl-conf":{"title":"sysctl.conf"},"dpkgZstDeb":{"title":"dpkg 安装 zst 的 deb 包"},"chinese-fonts":{"title":"中文字体配置"},"nix-vim":{"title":"简单使用 nix 的包管理器"}}},{"name":"alpine-openrc","route":"/OS/Linux/alpine-openrc","frontMatter":{"title":"Alpine Openrc","filePath":"content/OS/Linux/alpine-openrc.mdx","timestamp":1740644164000},"title":"Alpine 管理服务"},{"name":"sysctl-conf","route":"/OS/Linux/sysctl-conf","frontMatter":{"title":"Sysctl Conf","filePath":"content/OS/Linux/sysctl-conf.mdx","timestamp":1740644164000},"title":"sysctl.conf"},{"name":"dpkgZstDeb","route":"/OS/Linux/dpkgZstDeb","frontMatter":{"title":"解决 dpkg 无法安装 zst 的 deb 包","filePath":"content/OS/Linux/dpkgZstDeb.mdx","timestamp":1740644164000},"title":"dpkg 安装 zst 的 deb 包"},{"name":"chinese-fonts","route":"/OS/Linux/chinese-fonts","frontMatter":{"title":"Debian / Ubuntu","filePath":"content/OS/Linux/chinese-fonts.mdx","timestamp":1740644164000},"title":"中文字体配置"},{"name":"nix-vim","route":"/OS/Linux/nix-vim","frontMatter":{"title":"简单使用 nix 的包管理器","filePath":"content/OS/Linux/nix-vim.mdx","timestamp":1740644164000},"title":"简单使用 nix 的包管理器"},{"name":"Android-on-Linux","route":"/OS/Linux/Android-on-Linux","frontMatter":{"title":"Linux 下的 Android","filePath":"content/OS/Linux/Android-on-Linux.mdx","timestamp":1740644164000},"title":"Linux 下的 Android"},{"name":"dropbear","route":"/OS/Linux/dropbear","frontMatter":{"title":"Dropbear","filePath":"content/OS/Linux/dropbear.mdx","timestamp":1740644164000},"title":"Dropbear"},{"name":"oh-my-zsh","route":"/OS/Linux/oh-my-zsh","frontMatter":{"title":"Oh My Zsh","filePath":"content/OS/Linux/oh-my-zsh.mdx","timestamp":1740644164000},"title":"Oh My Zsh"},{"name":"swap","route":"/OS/Linux/swap","frontMatter":{"title":"Swap","filePath":"content/OS/Linux/swap.mdx","timestamp":1740644164000},"title":"Swap"},{"name":"zimfw","route":"/OS/Linux/zimfw","frontMatter":{"title":"Zimfw","filePath":"content/OS/Linux/zimfw.mdx","timestamp":1740644164000},"title":"Zimfw"}],"title":"Linux"},{"name":"Mac","route":"/OS/Mac","children":[{"name":"oh-my-zsh","route":"/OS/Mac/oh-my-zsh","frontMatter":{"title":"Oh My Zsh","filePath":"content/OS/Mac/oh-my-zsh.mdx","timestamp":1740644164000},"title":"Oh My Zsh"}],"title":"Mac"},{"name":"Windows","route":"/OS/Windows","children":[{"data":{"diskpart":{"title":"磁盘管理"}}},{"name":"diskpart","route":"/OS/Windows/diskpart","frontMatter":{"title":"Diskpart","filePath":"content/OS/Windows/diskpart.mdx","timestamp":1740644164000},"title":"磁盘管理"},{"name":"AutoStartup","route":"/OS/Windows/AutoStartup","frontMatter":{"title":"Autostartup","filePath":"content/OS/Windows/AutoStartup.md","timestamp":1740644164000},"title":"Autostartup"},{"name":"CacheDir","route":"/OS/Windows/CacheDir","frontMatter":{"title":"系统/常用软件的临时文件/缓存目录","filePath":"content/OS/Windows/CacheDir.mdx","timestamp":1740644164000},"title":"系统/常用软件的临时文件/缓存目录"},{"name":"Extensions","route":"/OS/Windows/Extensions","frontMatter":{"title":"Extensions","filePath":"content/OS/Windows/Extensions.mdx","timestamp":1740644164000},"title":"Extensions"},{"name":"Ventoy","route":"/OS/Windows/Ventoy","frontMatter":{"title":"Ventoy","filePath":"content/OS/Windows/Ventoy.mdx","timestamp":1740644164000},"title":"Ventoy"},{"name":"WindowsIOT","route":"/OS/Windows/WindowsIOT","frontMatter":{"title":"Windows 11 IOT Enterprise LTSC","filePath":"content/OS/Windows/WindowsIOT.mdx","timestamp":1740644164000},"title":"Windows 11 IOT Enterprise LTSC"},{"name":"oh-my-posh","route":"/OS/Windows/oh-my-posh","frontMatter":{"title":"使用 oh-my-posh 优化 Windows Terminal 体验","filePath":"content/OS/Windows/oh-my-posh.mdx","timestamp":1740644164000},"title":"使用 oh-my-posh 优化 Windows Terminal 体验"},{"name":"package-manager","route":"/OS/Windows/package-manager","frontMatter":{"title":"Package Manager","filePath":"content/OS/Windows/package-manager.mdx","timestamp":1740644164000},"title":"Package Manager"},{"name":"shortcut","route":"/OS/Windows/shortcut","frontMatter":{"title":"Windows 配置命令快捷键","filePath":"content/OS/Windows/shortcut.mdx","timestamp":1740644164000},"title":"Windows 配置命令快捷键"}],"title":"Windows"}],"title":"OS"},{"name":"misc","route":"/misc","children":[{"data":{"Dev":{"title":"开发"},"EnvInstall":{"title":"环境安装"},"acme-sh":{"title":"acme.sh 证书管理"},"nginx-proxy":{"title":"Nginx 反向代理"}}},{"name":"Dev","route":"/misc/Dev","children":[{"name":"git-config","route":"/misc/Dev/git-config","frontMatter":{"title":"git 一些常用的配置","filePath":"content/misc/Dev/git-config.md","timestamp":1740644164000},"title":"git 一些常用的配置"},{"name":"git-workflow","route":"/misc/Dev/git-workflow","frontMatter":{"title":"Git Workflow","filePath":"content/misc/Dev/git-workflow.md","timestamp":1740644164000},"title":"Git Workflow"}],"title":"开发"},{"name":"EnvInstall","route":"/misc/EnvInstall","children":[{"name":"Docker","route":"/misc/EnvInstall/Docker","frontMatter":{"title":"Docker","filePath":"content/misc/EnvInstall/Docker.mdx","timestamp":1740644164000},"title":"Docker"},{"name":"build-base","route":"/misc/EnvInstall/build-base","frontMatter":{"title":"安装编译环境","filePath":"content/misc/EnvInstall/build-base.mdx","timestamp":1740644164000},"title":"安装编译环境"},{"name":"php","route":"/misc/EnvInstall/php","frontMatter":{"title":"PHP","filePath":"content/misc/EnvInstall/php.mdx","timestamp":1740644164000},"title":"PHP"}],"title":"环境安装"},{"name":"acme-sh","route":"/misc/acme-sh","frontMatter":{"title":"安装 acme.sh","filePath":"content/misc/acme-sh.mdx","timestamp":1740644164000},"title":"acme.sh 证书管理"},{"name":"nginx-proxy","route":"/misc/nginx-proxy","frontMatter":{"title":"Nginx Proxy","filePath":"content/misc/nginx-proxy.mdx","timestamp":1740644164000},"title":"Nginx 反向代理"},{"name":"curl","route":"/misc/curl","frontMatter":{"title":"cURL","filePath":"content/misc/curl.mdx","timestamp":1740644164000},"title":"cURL"}],"title":"杂项"},{"name":"other","route":"/other","children":[{"data":{"tabby-web":{"title":"tabby 自建同步服务 tabby-web 记录"},"prefer-mosdns":{"title":" 使用 mosdns 提前进行 dns 进行分流"},"openclash-dns-ipv4-prefer":{"title":"路由上的 OpenClash DNS 双栈优先 IPv4 配置"},"proxy-network":{"title":"科学上网"}}},{"name":"tabby-web","route":"/other/tabby-web","frontMatter":{"title":"tabby 自建 tabby-web 同步配置","filePath":"content/other/tabby-web.mdx","timestamp":1740644164000},"title":"tabby 自建同步服务 tabby-web 记录"},{"name":"prefer-mosdns","route":"/other/prefer-mosdns","frontMatter":{"title":"使用 mosdns 提前进行 dns 进行分流","filePath":"content/other/prefer-mosdns.mdx","timestamp":1740644164000},"title":" 使用 mosdns 提前进行 dns 进行分流"},{"name":"openclash-dns-ipv4-prefer","route":"/other/openclash-dns-ipv4-prefer","frontMatter":{"title":"Openclash DNS Ipv4 Prefer","filePath":"content/other/openclash-dns-ipv4-prefer.mdx","timestamp":1740644164000},"title":"路由上的 OpenClash DNS 双栈优先 IPv4 配置"},{"name":"proxy-network","route":"/other/proxy-network","frontMatter":{"title":"Proxy Network","filePath":"content/other/proxy-network.mdx","timestamp":1740644164000},"title":"科学上网"}],"title":"其他"},{"name":"links","route":"/links","frontMatter":{"title":"Links","filePath":"content/links.mdx","timestamp":1740644164000},"title":"Links ↗"}],"navbar":["$","header",null,{"className":"nextra-navbar x:sticky x:top-0 x:z-30 x:w-full x:bg-transparent x:print:hidden x:max-md:[.nextra-banner:not([class$=hidden])~&]:top-(--nextra-banner-height)","children":[["$","div",null,{"className":"nextra-navbar-blur x:absolute x:-z-1 x:size-full nextra-border x:border-b x:backdrop-blur-md x:bg-nextra-bg/70"}],["$","nav",null,{"style":{"height":"var(--nextra-navbar-height)"},"className":"x:mx-auto x:flex x:max-w-(--nextra-content-width) x:items-center x:gap-4 x:pl-[max(env(safe-area-inset-left),1.5rem)] x:pr-[max(env(safe-area-inset-right),1.5rem)] x:justify-end","children":[["$","$L13",null,{"href":"/","className":"x:flex x:items-center x:me-auto x:transition-opacity x:focus-visible:nextra-focus x:hover:opacity-75","children":["$","div",null,{"className":"flex items-center space-x-2","children":["$","b",null,{"children":"mengshouer's web"}]}]}],["$","$L14",null,{"className":"","children":[["$","a",null,{"href":"https://github.com/mengshouer","target":"_blank","rel":"noreferrer","children":[["$","svg",null,{"fill":"currentColor","viewBox":"3 3 18 18","height":"24","children":["$","path",null,{"d":"$15"}]}],false],"className":"x:focus-visible:nextra-focus"}],"$undefined",["$","div",null,{"className":"flex items-center justify-center","children":["$","$L16",null,{}]}]]}]]}]]}],"footer":"$undefined","children":[["$","$L17",null,{}],["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[],[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]]],"forbidden":"$undefined","unauthorized":"$undefined"}]]}]]}]}],["$","$L18",null,{}],["$","$L19",null,{}]]}]]}]
1a:I[4431,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"Sidebar"]
1b:I[7946,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"ClientWrapper"]
1c:I[7232,["545","static/chunks/c16f53c3-ee54d6699103522a.js","954","static/chunks/954-18004590dc614f2c.js","728","static/chunks/728-7c60a700dd3f68c6.js","217","static/chunks/app/%5B%5B...mdxPath%5D%5D/page-9fef13f211ac4d14.js"],"HeadingAnchor"]
5:["$","div",null,{"className":"x:mx-auto x:flex x:max-w-(--nextra-content-width)","children":[["$","$L1a",null,{"toc":[{"value":"什么是跨域","id":"什么是跨域","depth":2},{"value":"如何判定跨域","id":"如何判定跨域","depth":2},{"value":"跨域的解决方案","id":"跨域的解决方案","depth":2},{"value":"CORS (Cross-Origin Resource Sharing)","id":"cors-cross-origin-resource-sharing","depth":3},{"value":"涉及到的端:","id":"涉及到的端","depth":4},{"value":"具体实现方式:","id":"具体实现方式","depth":4},{"value":"简单请求","id":"简单请求","depth":4},{"value":"需预检请求","id":"需预检请求","depth":4},{"value":"反向代理","id":"反向代理","depth":3},{"value":"涉及到的端","id":"涉及到的端-1","depth":4},{"value":"具体实现方式","id":"具体实现方式-1","depth":4},{"value":"JSONP","id":"jsonp","depth":3},{"value":"非常用方式","id":"非常用方式","depth":3},{"value":"参考","id":"参考","depth":2}]}],["$","$L1b",null,{"toc":"$5:props:children:0:props:toc","metadata":{"title":"浏览器跨域","filePath":"content/frontend/network/browser-cross-origin.mdx","timestamp":1740644164000},"bottomContent":"$undefined","children":[["$","div",null,{"id":"nextra-skip-nav"}],["$","main",null,{"data-pagefind-body":true,"children":[["$","h1",null,{"id":"$undefined","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-bold x:mt-2 x:text-4xl","children":["浏览器跨域","$undefined"]}],"\n",["$","h2",null,{"id":"什么是跨域","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-10 x:border-b x:pb-1 x:text-3xl nextra-border","children":["什么是跨域",["$","$L1c",null,{"id":"什么是跨域"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":["跨域问题的来源是浏览器为了",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"请求安全"}],"而引入的基于",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"同源策略"}],"的安全特性。当页面和请求的",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"协议"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"主机名"}],"或",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"端口"}],"不同时,浏览器判定两者不同源,即为跨域请求。需要注意的是跨域是",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"浏览器的限制"}],",服务端并不受此影响。当产生跨域时,我们可以通过 JSONP、CORS、postMessage 等方式解决。"]}],"\n",["$","h2",null,{"id":"如何判定跨域","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-10 x:border-b x:pb-1 x:text-3xl nextra-border","children":["如何判定跨域",["$","$L1c",null,{"id":"如何判定跨域"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":["比如一个域名是:",["$","a",null,{"href":"https://example.com:443","target":"_blank","rel":"noreferrer","className":"x:focus-visible:nextra-focus x:text-primary-600 x:underline x:hover:no-underline x:decoration-from-font x:[text-underline-position:from-font]","children":["https://example.com:443",[" ",["$","svg",null,{"fill":"none","stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","strokeWidth":1.7,"viewBox":"0 0 24 24","height":"1em","className":"x:inline x:align-baseline x:shrink-0","children":[["$","path",null,{"d":"M7 17L17 7"}],["$","path",null,{"d":"M7 7h10v10"}]]}]]]}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":["则,",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"https"}]," 是",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"协议"}],",",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"example.com"}]," 是",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"主机名"}],",",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"443"}]," 是",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"端口"}]," 这三块也是同源策略的判定条件,只有当协议、主机名和端口都相同时,浏览器才判定两者是同源关系,否则即为跨域。"]}],"\n",["$","h2",null,{"id":"跨域的解决方案","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-10 x:border-b x:pb-1 x:text-3xl nextra-border","children":["跨域的解决方案",["$","$L1c",null,{"id":"跨域的解决方案"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"前端常见的跨域解决方案有 CORS、反向代理(Reverse Proxy)、JSONP 等。"}],"\n",["$","h3",null,{"id":"cors-cross-origin-resource-sharing","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-2xl","children":["CORS (Cross-Origin Resource Sharing)",["$","$L1c",null,{"id":"cors-cross-origin-resource-sharing"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"CORS 是目前最为广泛的解决跨域问题的方案。方案依赖服务端/后端在响应头中添加 Access-Control-Allow-* 头,告知浏览器端通过此请求。"}],"\n",["$","h4",null,{"id":"涉及到的端","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-xl","children":["涉及到的端:",["$","$L1c",null,{"id":"涉及到的端"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"CORS 只需要服务端/后端支持即可,不涉及前端改动。"}],"\n",["$","h4",null,{"id":"具体实现方式","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-xl","children":["具体实现方式:",["$","$L1c",null,{"id":"具体实现方式"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"CORS 将请求分为简单请求(Simple Requests)和需预检请求(Preflighted requests),不同场景有不同的行为:"}],"\n",["$","h4",null,{"id":"简单请求","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-xl","children":["简单请求",["$","$L1c",null,{"id":"简单请求"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"不会触发预检请求的称为简单请求。当请求满足以下条件时就是一个简单请求:"}],"\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":["请求方法:",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"GET"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"HEAD"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"POST"}],"。"]}],"\n",["$","li",null,{"className":"x:my-2","children":["请求头:",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Accept"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Accept-Language"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Content-Language"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Content-Type"}],"。","\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":["Content-Type 仅支持:",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"application/x-www-form-urlencoded"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"multipart/form-data"}],"、",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"text/plain"}],"。"]}],"\n"]}],"\n"]}],"\n"]}],"\n",["$","h4",null,{"id":"需预检请求","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-xl","children":["需预检请求",["$","$L1c",null,{"id":"需预检请求"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":["当一个请求不满足以上简单请求的条件时,浏览器会自动向服务端发送一个 OPTIONS 请求,通过服务端返回的 ",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Access-Control-Allow-*"}]," 判定请求是否被允许。"]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":["CORS 引入了以下几个以 ",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Access-Control-Allow-*"}]," 开头:"]}],"\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":[["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Access-Control-Allow-Origin"}]," 表示允许的来源"]}],"\n",["$","li",null,{"className":"x:my-2","children":[["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Access-Control-Allow-Methods"}]," 表示允许的请求方法"]}],"\n",["$","li",null,{"className":"x:my-2","children":[["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Access-Control-Allow-Headers"}]," 表示允许的请求头"]}],"\n",["$","li",null,{"className":"x:my-2","children":[["$","code",null,{"className":"nextra-code","dir":"ltr","children":"Access-Control-Allow-Credentials"}]," 表示允许携带认证信息"]}],"\n"]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"当请求符合响应头的这些条件时,浏览器才会发送并响应正式的请求。"}],"\n",["$","h3",null,{"id":"反向代理","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-2xl","children":["反向代理",["$","$L1c",null,{"id":"反向代理"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"反向代理解决跨域问题的方案依赖同源的服务端对请求做一个转发处理,将请求从跨域请求转换成同源请求。"}],"\n",["$","h4",null,{"id":"涉及到的端-1","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-xl","children":["涉及到的端",["$","$L1c",null,{"id":"涉及到的端-1"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"反向代理只需要服务端/后端支持,几乎不涉及前端改动,只用切换接口即可。"}],"\n",["$","h4",null,{"id":"具体实现方式-1","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-xl","children":["具体实现方式",["$","$L1c",null,{"id":"具体实现方式-1"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"反向代理的实现方式为在页面同域下配置一套反向代理服务,页面请求同域的服务端,服务端请求上游的实际的服务端,之后将结果返回给前端。"}],"\n",["$","h3",null,{"id":"jsonp","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-2xl","children":["JSONP",["$","$L1c",null,{"id":"jsonp"}]]}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"JSONP 是一个相对古老的跨域解决方案,只支持 GET 请求。主要是利用了浏览器加载 JavaScript 资源文件时不受同源策略的限制而实现跨域获取数据。"}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"涉及到的端"}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"JSONP 需要服务端和前端配合实现。"}],"\n",["$","p",null,{"className":"x:not-first:mt-6 x:leading-7","children":"具体实现方式"}],"\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":["创建 ",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"<script>"}]," 标签:在网页中动态创建一个 ",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"<script>"}]," 标签。"]}],"\n",["$","li",null,{"className":"x:my-2","children":["请求数据:将目标服务器的 URL 设置为 ",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"<script>"}]," 标签的 src 属性。"]}],"\n",["$","li",null,{"className":"x:my-2","children":["回调函数:服务器返回的数据不是纯粹的 JSON,而是一个函数调用,并且这个函数是在客户端预先定义好的。服务器返回的数据格式通常是这样的:",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"callbackFunction({\"key\": \"value\"});"}]]}],"\n",["$","li",null,{"className":"x:my-2","children":["执行回调:当 ",["$","code",null,{"className":"nextra-code","dir":"ltr","children":"<script>"}]," 加载完成后,返回的 JavaScript 代码会被执行,调用预先定义好的回调函数,并将数据传递给它。"]}],"\n"]}],"\n",["$","h3",null,{"id":"非常用方式","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-8 x:text-2xl","children":["非常用方式",["$","$L1c",null,{"id":"非常用方式"}]]}],"\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":["postMessage","\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":"即在两个 origin 下分别部署一套页面 A 与 B,A 页面通过 iframe 加载 B 页面并监听消息,B 页面发送消息。"}],"\n"]}],"\n"]}],"\n",["$","li",null,{"className":"x:my-2","children":["window.name","\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":"主要是利用 window.name 页面跳转不改变的特性实现跨域,即 iframe 加载一个跨域页面,设置 window.name,跳转到同域页面,可以通过 $(‘iframe’).contentWindow.name 拿到跨域页面的数据。"}],"\n"]}],"\n"]}],"\n",["$","li",null,{"className":"x:my-2","children":["document.domain","\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":"可将相同一级域名下的子域名页面的 document.domain 设置为一级域名实现跨域。"}],"\n",["$","li",null,{"className":"x:my-2","children":"可将同域不同端口的 document.domain 设置为同域名实现跨域(端口被置为 null)。"}],"\n"]}],"\n"]}],"\n"]}],"\n",["$","h2",null,{"id":"参考","className":"x:tracking-tight x:text-slate-900 x:dark:text-slate-100 x:font-semibold x:target:animate-[fade-in_1.5s] x:mt-10 x:border-b x:pb-1 x:text-3xl nextra-border","children":["参考",["$","$L1c",null,{"id":"参考"}]]}],"\n",["$","ul",null,{"className":"x:[:is(ol,ul)_&]:my-3 x:not-first:mt-6 x:list-disc x:ms-6","children":["\n",["$","li",null,{"className":"x:my-2","children":["$","a",null,{"href":"https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS","target":"_blank","rel":"noreferrer","className":"x:focus-visible:nextra-focus x:text-primary-600 x:underline x:hover:no-underline x:decoration-from-font x:[text-underline-position:from-font]","children":["https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS",[" ",["$","svg",null,{"fill":"none","stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","strokeWidth":1.7,"viewBox":"0 0 24 24","height":"1em","className":"x:inline x:align-baseline x:shrink-0","children":[["$","path",null,{"d":"M7 17L17 7"}],["$","path",null,{"d":"M7 7h10v10"}]]}]]]}]}],"\n",["$","li",null,{"className":"x:my-2","children":["$","a",null,{"href":"https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy","target":"_blank","rel":"noreferrer","className":"x:focus-visible:nextra-focus x:text-primary-600 x:underline x:hover:no-underline x:decoration-from-font x:[text-underline-position:from-font]","children":["https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy",[" ",["$","svg",null,{"fill":"none","stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","strokeWidth":1.7,"viewBox":"0 0 24 24","height":"1em","className":"x:inline x:align-baseline x:shrink-0","children":[["$","path",null,{"d":"M7 17L17 7"}],["$","path",null,{"d":"M7 7h10v10"}]]}]]]}]}],"\n",["$","li",null,{"className":"x:my-2","children":["$","a",null,{"href":"https://github.com/hzfe/awesome-interview","target":"_blank","rel":"noreferrer","className":"x:focus-visible:nextra-focus x:text-primary-600 x:underline x:hover:no-underline x:decoration-from-font x:[text-underline-position:from-font]","children":["https://github.com/hzfe/awesome-interview",[" ",["$","svg",null,{"fill":"none","stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","strokeWidth":1.7,"viewBox":"0 0 24 24","height":"1em","className":"x:inline x:align-baseline x:shrink-0","children":[["$","path",null,{"d":"M7 17L17 7"}],["$","path",null,{"d":"M7 7h10v10"}]]}]]]}]}],"\n"]}]]}]]}]]}]
b:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
9:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"浏览器跨域"}],["$","meta","2",{"name":"description","content":"mengshouer's web"}],["$","meta","3",{"name":"application-name","content":"mengshouer's web"}],["$","meta","4",{"name":"generator","content":"Next.js"}],["$","meta","5",{"name":"keywords","content":"Nextra,Next.js,React,JavaScript,MDX,Markdown,Static Site Generator,mengshouer,blog,SnowFox,雪狐,xn--e5x138e"}],["$","meta","6",{"name":"msapplication-TileColor","content":"#fff"}],["$","link","7",{"rel":"canonical","href":"https://www.xn--e5x138e.com/frontend/network/browser-cross-origin"}],["$","meta","8",{"name":"mobile-web-app-capable","content":"yes"}],["$","meta","9",{"name":"apple-mobile-web-app-title","content":"mengshouer's web"}],["$","meta","10",{"name":"apple-mobile-web-app-status-bar-style","content":"default"}]]
7:null