当前位置:首页 > 文章列表 > 文章 > 前端 > 读取HTML文件内容技巧分享

读取HTML文件内容技巧分享

2026-05-25 10:17:14 0浏览 收藏
本文深入解析了在不同环境下安全、高效读取和解析HTML文件的核心技巧:针对浏览器中fetch加载本地HTML触发CORS错误的问题,明确指出file://协议被浏览器安全策略禁止,并给出部署本地HTTP服务或改用XMLHttpRequest的实用解决方案;强调DOMParser解析HTML字符串比innerHTML更安全可靠,避免脚本执行与DOM污染;在Node.js环境中则重点提醒fs读取时的编码与路径陷阱,并对比cheerio与jsdom在服务端批量处理HTML时的性能、兼容性与容错优势,同时点出编码识别这一常被忽视却至关重要的环节——真正帮你避开从读取到解析全流程中的典型坑。

如何读取html_读取HTML文件内容或元素的技巧【指南】

fetch 读取本地 HTML 文件会触发 CORS 错误

浏览器直接用 fetch('./page.html') 加载本地 HTML 文件时,如果页面是通过 file:// 协议打开的,绝大多数现代浏览器会拒绝请求,并抛出类似 Blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. 的错误。

这不是代码写错了,而是浏览器安全策略限制——file:// 协议不被视作合法的跨域请求源。解决方法只有两个:

  • 把页面部署到本地 HTTP 服务上(推荐),比如用 npx servepython3 -m http.server 或 VS Code 的 Live Server 插件
  • 改用 XMLHttpRequest 并设置 responseType = 'document'(仅限同源且非 file:// 场景)

别试图用 readAsText + FileReader 去读取用户选择的 HTML 文件——那只能用于 显式选取的场景,不适用于预设路径加载。

DOMParser 解析 HTML 字符串比 innerHTML 更安全可靠

当你拿到一段 HTML 字符串(比如从 fetch 返回的 text() 结果),想提取其中的 </code> 或某个 <code>class="content"</code> 元素,不要直接往 <code>div.innerHTML</code> 里塞再查——这会执行内联脚本、触发图片加载、污染当前页面 DOM。</p> <p><code>DOMParser</code> 是专为此设计的轻量级解析器,它生成的是独立文档对象,完全隔离:</p> <pre class="brush:php;toolbar:false">const parser = new DOMParser(); const doc = parser.parseFromString(htmlString, 'text/html'); const title = doc.querySelector('title')?.textContent; const mainContent = doc.querySelector('.content')?.outerHTML;</pre> <p>注意两点:</p> <ul><li>MIME 类型必须写成 <code>'text/html'</code>,写成 <code>'application/xml'</code> 或漏掉会导致解析失败或行为异常</li> <li><code>doc</code> 是完整文档,所以 <code>querySelector</code> 能直接匹配 <code><head></code> 和 <code><body></code> 下的元素,无需额外包裹</li> </ul><h3>Node.js 环境下读取 HTML 文件要用 <code>fs.readFileSync</code> 或 <code>fs.promises.readFile</code></h3> <p>在 Node.js 里没有 <code>fetch</code>,也不能用 <code>DOMParser</code>(原生不支持),得靠第三方库补全 DOM 能力。但第一步永远是把文件内容读成字符串:</p> <pre class="brush:php;toolbar:false">const fs = require('fs'); const html = fs.readFileSync('./index.html', 'utf8');</pre> <p>或者用 Promise 版本:</p> <pre class="brush:php;toolbar:false">const { readFile } = require('fs').promises; const html = await readFile('./index.html', 'utf8');</pre> <p>常见坑:</p> <ul><li>忘记传 <code>'utf8'</code> 编码参数,结果得到 <code>Buffer</code>,后续 <code>parseFromString</code> 会报错</li> <li>路径写相对路径却没注意工作目录(<code>process.cwd()</code>),建议用 <code>path.resolve(__dirname, 'index.html')</code> 定位</li> </ul><p>之后才能交给 <code>jsdom</code> 或 <code>cheerio</code> 处理。例如 cheerio 的典型用法:</p> <pre class="brush:php;toolbar:false">const $ = require('cheerio'); const html = fs.readFileSync('./index.html', 'utf8'); const $html = $.load(html); const title = $html('title').text();</pre> <h3>用 <code>cheerio</code> 提取元素比原生 DOM API 更适合服务端批量处理</h3> <p>如果你在 Node.js 中要批量分析几十个 HTML 文件、提取标题、链接、元数据,<code>cheerio</code> 是更优选择:它模拟了 jQuery API,语法简洁,不渲染、不执行 JS、内存占用低。</p> <p>对比 <code>jsdom</code>:</p> <ul><li><code>cheerio</code> 没有 <code>window</code>、<code>document</code> 全局对象,不能运行脚本,但解析速度通常快 3–5 倍</li> <li><code>cheerio.load()</code> 返回的是“伪 DOM”,所有选择器操作都基于字符串分析,因此不支持 <code>:has()</code>、<code>:nth-child(2n)</code> 等复杂 CSS4 伪类(除非升级到 v1.0+ 并启用 <code>xmlMode: false</code>)</li> <li>若 HTML 不规范(如自闭合标签写成 <code><img></code> 而非 <code><img/></code>),<code>cheerio</code> 默认能容错,<code>DOMParser</code> 在严格模式下可能报错</li> </ul><p>一个真实场景示例:提取所有带 <code>href</code> 的外链,并排除站内路径:</p> <pre class="brush:php;toolbar:false">const $ = require('cheerio'); const html = fs.readFileSync('page.html', 'utf8'); const $html = $.load(html); const externalLinks = []; $html('a[href]').each((i, el) => { const href = $html(el).attr('href'); if (href && /^https?:\/\//.test(href)) { externalLinks.push(href); } });</pre> 实际处理 HTML 时,最易被忽略的是编码识别——特别是老站点用 <code>gbk</code> 或 <code>big5</code> 编码却没声明 <code><meta charset></code>,这时 <code>fs.readFileSync</code> 或 <code>fetch</code> 拿到的内容会乱码,后续所有解析都失效。遇到这类情况,得先用 <code>iconv-lite</code> 或 <code>encoding-sniffer</code> 探测真实编码再转 UTF-8。<p>理论要掌握,实操不能落!以上关于《读取HTML文件内容技巧分享》的详细介绍,大家都掌握了吧!如果想要继续提升自己的能力,那么就来关注golang学习网公众号吧!</p> </div> <div class="labsList"> </div> <div class="cateBox"> <div class="cateItem"> <a href="/article/610849.html" title="Golang JSON流式编解码技巧" class="img_box"> <img src="/uploads/20260525/17796753226a13b0ba7afc1.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="Golang JSON流式编解码技巧">Golang JSON流式编解码技巧 </a> <dl> <dt class="lineOverflow"><a href="/article/610849.html" title="Golang JSON流式编解码技巧" class="aBlack">上一篇<i></i></a></dt> <dd class="lineTwoOverflow">Golang JSON流式编解码技巧</dd> </dl> </div> <div class="cateItem"> <a href="/article/610851.html" title="喜马拉雅会员如何跨平台迁移" class="img_box"> <img src="/uploads/20260525/17796755046a13b17027c60.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="喜马拉雅会员如何跨平台迁移"> </a> <dl> <dt class="lineOverflow"><a href="/article/610851.html" class="aBlack" title="喜马拉雅会员如何跨平台迁移">下一篇<i></i></a></dt> <dd class="lineTwoOverflow">喜马拉雅会员如何跨平台迁移</dd> </dl> </div> </div> </div> </div> <div class="leftContBox pt0"> <div class="pdl20"> <div class="contTit"> <a href="/articlelist.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit">最新文章</div> </div> </div> <ul class="newArticleList"> <li> <div class="contBox"> <a href="/article/622971.html" class="img_box" title="Web Streams TransformStream 如何处理背压:ReadableStream 到 WritableStream 的队列边界"> <img src="/uploads/20260828/1787869508-streams-data-path.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Web Streams TransformStream 如何处理背压:ReadableStream 到 WritableStream 的队列边界"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  50分钟前  |   <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/5401_new_0_1.html" class="aLightGray" title="前端开发">前端开发</a> · <a href="/articletag/41222_new_0_1.html" class="aLightGray" title="浏览器 API">浏览器 API</a> · <a href="javascript:;" class="aLightGray" title="ReadableStream">ReadableStream</a> <a href="javascript:;" class="aLightGray" title="背压">背压</a> <a href="javascript:;" class="aLightGray" title="Web Streams">Web Streams</a> <a href="javascript:;" class="aLightGray" title="TransformStream">TransformStream</a> <a href="javascript:;" class="aLightGray" title="WritableStream">WritableStream</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622971.html" class="aBlack" target="_blank" title="Web Streams TransformStream 如何处理背压:ReadableStream 到 WritableStream 的队列边界">Web Streams TransformStream 如何处理背压:ReadableStream 到 WritableStream 的队列边界</a> </dt> <dd class="cont2"> <span><i class="view"></i>428浏览</span> <span class="collectBtn user_collection" data-id="622971" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622947.html" class="img_box" title="popover 属性关闭时为什么没有动画:CSS 离散过渡、overlay 与 top-layer 的退出顺序"> <img src="/uploads/20260828/1787865267-popover-break-chain.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="popover 属性关闭时为什么没有动画:CSS 离散过渡、overlay 与 top-layer 的退出顺序"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  2小时前  |   <a href="/articletag/243_new_0_1.html" class="aLightGray" title="前端">前端</a> · <a href="/articletag/4729_new_0_1.html" class="aLightGray" title="css">css</a> · <a href="/articletag/40780_new_0_1.html" class="aLightGray" title="Web API">Web API</a> · <a href="/articletag/41348_new_0_1.html" class="aLightGray" title="交互动画">交互动画</a> · <a href="javascript:;" class="aLightGray" title="display">display</a> <a href="javascript:;" class="aLightGray" title="@starting-style">@starting-style</a> <a href="javascript:;" class="aLightGray" title="popover">popover</a> <a href="javascript:;" class="aLightGray" title="CSS transition-behavior">CSS transition-behavior</a> <a href="javascript:;" class="aLightGray" title="overlay">overlay</a> <a href="javascript:;" class="aLightGray" title="top-layer">top-layer</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622947.html" class="aBlack" target="_blank" title="popover 属性关闭时为什么没有动画:CSS 离散过渡、overlay 与 top-layer 的退出顺序">popover 属性关闭时为什么没有动画:CSS 离散过渡、overlay 与 top-layer 的退出顺序</a> </dt> <dd class="cont2"> <span><i class="view"></i>225浏览</span> <span class="collectBtn user_collection" data-id="622947" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622920.html" class="img_box" title="Web Components 的 customElements.whenDefined 怎么处理组件先渲染后注册:升级时机与失败分支"> <img src="/uploads/20260828/1787860900-web-components-failure-branch.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Web Components 的 customElements.whenDefined 怎么处理组件先渲染后注册:升级时机与失败分支"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  3小时前  |   <a href="/articletag/240_new_0_1.html" class="aLightGray" title="html">html</a> · <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/41333_new_0_1.html" class="aLightGray" title="前端组件">前端组件</a> · <a href="javascript:;" class="aLightGray" title="Web Components">Web Components</a> <a href="javascript:;" class="aLightGray" title="customElements.whenDefined">customElements.whenDefined</a> <a href="javascript:;" class="aLightGray" title="CustomElementRegistry">CustomElementRegistry</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622920.html" class="aBlack" target="_blank" title="Web Components 的 customElements.whenDefined 怎么处理组件先渲染后注册:升级时机与失败分支">Web Components 的 customElements.whenDefined 怎么处理组件先渲染后注册:升级时机与失败分支</a> </dt> <dd class="cont2"> <span><i class="view"></i>404浏览</span> <span class="collectBtn user_collection" data-id="622920" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622890.html" class="img_box" title="前端 Cache API 如何按版本清理离线资源:请求匹配、缓存更新与失效回滚"> <img src="/uploads/20260828/1787856662-cache-match-network-fallback.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="前端 Cache API 如何按版本清理离线资源:请求匹配、缓存更新与失效回滚"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  4小时前  |   <a href="/articletag/243_new_0_1.html" class="aLightGray" title="前端">前端</a> · <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/10234_new_0_1.html" class="aLightGray" title="pwa">pwa</a> · <a href="/articletag/14884_new_0_1.html" class="aLightGray" title="Service Worker">Service Worker</a> · <a href="/articletag/41324_new_0_1.html" class="aLightGray" title="离线缓存">离线缓存</a> · <a href="javascript:;" class="aLightGray" title="Service Worker">Service Worker</a> <a href="javascript:;" class="aLightGray" title="CacheStorage">CacheStorage</a> <a href="javascript:;" class="aLightGray" title="Cache API">Cache API</a> <a href="javascript:;" class="aLightGray" title="caches.open">caches.open</a> <a href="javascript:;" class="aLightGray" title="caches.match">caches.match</a> <a href="javascript:;" class="aLightGray" title="caches.delete">caches.delete</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622890.html" class="aBlack" target="_blank" title="前端 Cache API 如何按版本清理离线资源:请求匹配、缓存更新与失效回滚">前端 Cache API 如何按版本清理离线资源:请求匹配、缓存更新与失效回滚</a> </dt> <dd class="cont2"> <span><i class="view"></i>418浏览</span> <span class="collectBtn user_collection" data-id="622890" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622856.html" class="img_box" title="CSS anchor positioning 实战:让浮层跟随目标元素并处理视口溢出"> <img src="/uploads/20260828/1787852247-anchor-overflow-fallback.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="CSS anchor positioning 实战:让浮层跟随目标元素并处理视口溢出"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  5小时前  |   <a href="/articletag/243_new_0_1.html" class="aLightGray" title="前端">前端</a> · <a href="/articletag/4729_new_0_1.html" class="aLightGray" title="css">css</a> · <a href="/articletag/41316_new_0_1.html" class="aLightGray" title="浮层">浮层</a> · <a href="/articletag/41317_new_0_1.html" class="aLightGray" title="浏览器布局">浏览器布局</a> · <a href="javascript:;" class="aLightGray" title="CSS">CSS</a> <a href="javascript:;" class="aLightGray" title="anchor positioning">anchor positioning</a> <a href="javascript:;" class="aLightGray" title="anchor-name">anchor-name</a> <a href="javascript:;" class="aLightGray" title="position-area">position-area</a> <a href="javascript:;" class="aLightGray" title="position-try-fallbacks">position-try-fallbacks</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622856.html" class="aBlack" target="_blank" title="CSS anchor positioning 实战:让浮层跟随目标元素并处理视口溢出">CSS anchor positioning 实战:让浮层跟随目标元素并处理视口溢出</a> </dt> <dd class="cont2"> <span><i class="view"></i>373浏览</span> <span class="collectBtn user_collection" data-id="622856" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622829.html" class="img_box" title="ResizeObserver 为什么会触发 loop completed with undelivered notifications:用 requestAnimationFrame 拆开布局反馈"> <img src="/uploads/20260828/1787848005-raf-layout-boundary.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="ResizeObserver 为什么会触发 loop completed with undelivered notifications:用 requestAnimationFrame 拆开布局反馈"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  6小时前  |   <a href="/articletag/861_new_0_1.html" class="aLightGray" title="性能">性能</a> · <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/40054_new_0_1.html" class="aLightGray" title="浏览器API">浏览器API</a> · <a href="javascript:;" class="aLightGray" title="requestAnimationFrame">requestAnimationFrame</a> <a href="javascript:;" class="aLightGray" title="ResizeObserver">ResizeObserver</a> <a href="javascript:;" class="aLightGray" title="前端布局">前端布局</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622829.html" class="aBlack" target="_blank" title="ResizeObserver 为什么会触发 loop completed with undelivered notifications:用 requestAnimationFrame 拆开布局反馈">ResizeObserver 为什么会触发 loop completed with undelivered notifications:用 requestAnimationFrame 拆开布局反馈</a> </dt> <dd class="cont2"> <span><i class="view"></i>456浏览</span> <span class="collectBtn user_collection" data-id="622829" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622783.html" class="img_box" title="CSS zoom 怎么缩放局部内容:布局重排、transform 对比与响应式边界"> <img src="/uploads/20260827/1787839439-css-zoom-layout-flow.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="CSS zoom 怎么缩放局部内容:布局重排、transform 对比与响应式边界"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  9小时前  |   <a href="/articletag/161_new_0_1.html" class="aLightGray" title="布局">布局</a> · <a href="/articletag/243_new_0_1.html" class="aLightGray" title="前端">前端</a> · <a href="/articletag/4729_new_0_1.html" class="aLightGray" title="css">css</a> · <a href="/articletag/40483_new_0_1.html" class="aLightGray" title="浏览器兼容">浏览器兼容</a> · <a href="javascript:;" class="aLightGray" title="Zoom">Zoom</a> <a href="javascript:;" class="aLightGray" title="响应式布局">响应式布局</a> <a href="javascript:;" class="aLightGray" title="CSS zoom">CSS zoom</a> <a href="javascript:;" class="aLightGray" title="transform scale">transform scale</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622783.html" class="aBlack" target="_blank" title="CSS zoom 怎么缩放局部内容:布局重排、transform 对比与响应式边界">CSS zoom 怎么缩放局部内容:布局重排、transform 对比与响应式边界</a> </dt> <dd class="cont2"> <span><i class="view"></i>263浏览</span> <span class="collectBtn user_collection" data-id="622783" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622762.html" class="img_box" title="前端 Element.checkVisibility 怎么判断元素真正可见:CSS 与布局状态的边界"> <img src="/uploads/20260827/1787835050-checkvisibility-layout-path.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="前端 Element.checkVisibility 怎么判断元素真正可见:CSS 与布局状态的边界"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  10小时前  |   <a href="/articletag/243_new_0_1.html" class="aLightGray" title="前端">前端</a> · <a href="/articletag/2774_new_0_1.html" class="aLightGray" title="dom">dom</a> · <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/4729_new_0_1.html" class="aLightGray" title="css">css</a> · <a href="/articletag/40054_new_0_1.html" class="aLightGray" title="浏览器API">浏览器API</a> · <a href="javascript:;" class="aLightGray" title="Element.checkVisibility">Element.checkVisibility</a> <a href="javascript:;" class="aLightGray" title="visibilityProperty">visibilityProperty</a> <a href="javascript:;" class="aLightGray" title="opacityProperty">opacityProperty</a> <a href="javascript:;" class="aLightGray" title="contentVisibilityAuto">contentVisibilityAuto</a> <a href="javascript:;" class="aLightGray" title="前端可见性">前端可见性</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622762.html" class="aBlack" target="_blank" title="前端 Element.checkVisibility 怎么判断元素真正可见:CSS 与布局状态的边界">前端 Element.checkVisibility 怎么判断元素真正可见:CSS 与布局状态的边界</a> </dt> <dd class="cont2"> <span><i class="view"></i>292浏览</span> <span class="collectBtn user_collection" data-id="622762" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622742.html" class="img_box" title="window.postMessage 如何校验 origin:跨窗口通信的来源边界与回退策略"> <img src="/uploads/20260827/1787830860-postmessage-origin-gate.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="window.postMessage 如何校验 origin:跨窗口通信的来源边界与回退策略"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  11小时前  |   </span> </dd> <dt class="lineOverflow"> <a href="/article/622742.html" class="aBlack" target="_blank" title="window.postMessage 如何校验 origin:跨窗口通信的来源边界与回退策略">window.postMessage 如何校验 origin:跨窗口通信的来源边界与回退策略</a> </dt> <dd class="cont2"> <span><i class="view"></i>462浏览</span> <span class="collectBtn user_collection" data-id="622742" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622695.html" class="img_box" title="HTML dialog 如何处理表单提交后的关闭状态:showModal、close 与取消事件"> <img src="/uploads/20260827/1787817916-dialog-cancel-close-branch.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="HTML dialog 如何处理表单提交后的关闭状态:showModal、close 与取消事件"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  15小时前  |   </span> </dd> <dt class="lineOverflow"> <a href="/article/622695.html" class="aBlack" target="_blank" title="HTML dialog 如何处理表单提交后的关闭状态:showModal、close 与取消事件">HTML dialog 如何处理表单提交后的关闭状态:showModal、close 与取消事件</a> </dt> <dd class="cont2"> <span><i class="view"></i>229浏览</span> <span class="collectBtn user_collection" data-id="622695" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622675.html" class="img_box" title="JavaScript AbortSignal.any 怎么合并用户取消与超时:fetch 请求的竞态收口"> <img src="/uploads/20260827/1787813564-abortsignal-any-error-boundary.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="JavaScript AbortSignal.any 怎么合并用户取消与超时:fetch 请求的竞态收口"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  16小时前  |   <a href="/articletag/243_new_0_1.html" class="aLightGray" title="前端">前端</a> · <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/40974_new_0_1.html" class="aLightGray" title="Fetch API">Fetch API</a> · <a href="/articletag/41243_new_0_1.html" class="aLightGray" title="异步控制">异步控制</a> · <a href="javascript:;" class="aLightGray" title="JavaScript">JavaScript</a> <a href="javascript:;" class="aLightGray" title="请求超时">请求超时</a> <a href="javascript:;" class="aLightGray" title="AbortSignal.any">AbortSignal.any</a> <a href="javascript:;" class="aLightGray" title="AbortSignal.timeout">AbortSignal.timeout</a> <a href="javascript:;" class="aLightGray" title="fetch请求取消">fetch请求取消</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622675.html" class="aBlack" target="_blank" title="JavaScript AbortSignal.any 怎么合并用户取消与超时:fetch 请求的竞态收口">JavaScript AbortSignal.any 怎么合并用户取消与超时:fetch 请求的竞态收口</a> </dt> <dd class="cont2"> <span><i class="view"></i>276浏览</span> <span class="collectBtn user_collection" data-id="622675" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/622653.html" class="img_box" title="IntersectionObserver threshold 数组怎么设计:可见比例回调与首屏曝光去重"> <img src="/uploads/20260827/1787809248-intersection-ratio-path.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="IntersectionObserver threshold 数组怎么设计:可见比例回调与首屏曝光去重"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/88_new_0_1.html" class="aLightGray" title="前端">前端</a>   |  17小时前  |   <a href="/articletag/4701_new_0_1.html" class="aLightGray" title="javascript">javascript</a> · <a href="/articletag/39768_new_0_1.html" class="aLightGray" title="前端性能">前端性能</a> · <a href="/articletag/40054_new_0_1.html" class="aLightGray" title="浏览器API">浏览器API</a> · <a href="javascript:;" class="aLightGray" title="IntersectionObserver">IntersectionObserver</a> <a href="javascript:;" class="aLightGray" title="threshold">threshold</a> <a href="javascript:;" class="aLightGray" title="intersectionRatio">intersectionRatio</a> <a href="javascript:;" class="aLightGray" title="首屏曝光">首屏曝光</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/622653.html" class="aBlack" target="_blank" title="IntersectionObserver threshold 数组怎么设计:可见比例回调与首屏曝光去重">IntersectionObserver threshold 数组怎么设计:可见比例回调与首屏曝光去重</a> </dt> <dd class="cont2"> <span><i class="view"></i>133浏览</span> <span class="collectBtn user_collection" data-id="622653" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> </ul> </div> </div> <div class="mainRight"> <!-- 右侧广告位banner --> <div class="rightContBox" style="margin-top: 0px;"> <div class="rightTit"> <a href="/courselist.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit lineOverflow">课程推荐</div> </div> <ul class="lessonRecomRList"> <li> <a href="/course/9.html" class="img_box" target="_blank" title="前端进阶之JavaScript设计模式"> <img src="/uploads/20221222/52fd0f23a454c71029c2c72d206ed815.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="前端进阶之JavaScript设计模式"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/9.html" target="_blank" class="aBlack" title="前端进阶之JavaScript设计模式">前端进阶之JavaScript设计模式</a></dt> <dd class="cont1 lineTwoOverflow"> 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。 </dd> <dd class="cont2">543次学习</dd> </dl> </li> <li> <a href="/course/2.html" class="img_box" target="_blank" title="GO语言核心编程课程"> <img src="/uploads/20221221/634ad7404159bfefc6a54a564d437b5f.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="GO语言核心编程课程"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/2.html" target="_blank" class="aBlack" title="GO语言核心编程课程">GO语言核心编程课程</a></dt> <dd class="cont1 lineTwoOverflow"> 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。 </dd> <dd class="cont2">516次学习</dd> </dl> </li> <li> <a href="/course/74.html" class="img_box" target="_blank" title="简单聊聊mysql8与网络通信"> <img src="/uploads/20240103/bad35fe14edbd214bee16f88343ac57c.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="简单聊聊mysql8与网络通信"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/74.html" target="_blank" class="aBlack" title="简单聊聊mysql8与网络通信">简单聊聊mysql8与网络通信</a></dt> <dd class="cont1 lineTwoOverflow"> 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让 </dd> <dd class="cont2">500次学习</dd> </dl> </li> <li> <a href="/course/57.html" class="img_box" target="_blank" title="JavaScript正则表达式基础与实战"> <img src="/uploads/20221226/bbe4083bb3cb0dd135fb02c31c3785fb.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="JavaScript正则表达式基础与实战"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/57.html" target="_blank" class="aBlack" title="JavaScript正则表达式基础与实战">JavaScript正则表达式基础与实战</a></dt> <dd class="cont1 lineTwoOverflow"> 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。 </dd> <dd class="cont2">487次学习</dd> </dl> </li> <li> <a href="/course/28.html" class="img_box" target="_blank" title="从零制作响应式网站—Grid布局"> <img src="/uploads/20221223/ac110f88206daeab6c0cf38ebf5fe9ed.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="从零制作响应式网站—Grid布局"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/28.html" target="_blank" class="aBlack" title="从零制作响应式网站—Grid布局">从零制作响应式网站—Grid布局</a></dt> <dd class="cont1 lineTwoOverflow"> 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。 </dd> <dd class="cont2">485次学习</dd> </dl> </li> </ul> </div> <div class="rightContBox"> <div class="rightTit"> <a href="/ai.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit lineOverflow">AI推荐</div> </div> <ul class="lessonRecomRList"> <li> <a href="/ai/13109.html" target="_blank" title="ljg-skills - "Prompt之神"李继刚开源的 AI 技能集" class="img_box"> <img src="/uploads/ai/20260616/ljg-skills-icon-8bbe1468e5.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="ljg-skills - "Prompt之神"李继刚开源的 AI 技能集" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13109.html" class="aBlack" target="_blank" title="ljg-skills">ljg-skills</a></dt> <dd class="cont1 lineTwoOverflow"> ljg-skills 是李继刚开源的 AI 技能与提示词集合,面向大模型使用者整理了一批可复用的 prompt、角色设定和任务技能模板,适合用于学习提示词设计、搭建个人 AI 工作流和沉淀团队常用智能体能力。 </dd> <dd class="cont2">5355次使用</dd> </dl> </li> <li> <a href="/ai/13108.html" target="_blank" title="MELO音乐 - AI 音乐生成平台,支持多模态创作能力" class="img_box"> <img src="/uploads/ai/20260616/melo-icon-10bf590762.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="MELO音乐 - AI 音乐生成平台,支持多模态创作能力" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13108.html" class="aBlack" target="_blank" title="MELO音乐">MELO音乐</a></dt> <dd class="cont1 lineTwoOverflow"> MELO音乐是一站式AI视频与音乐制作助手,对标suno, udio的高品质体验。提供伴奏生成、原创写词、无损导出、哼唱识曲、混音变声等全套音频与短视频编辑工具。无论是流行Kpop、电音说唱、民谣古风、摇滚儿歌还是商用轻音乐,MELO为你免费谱曲,轻松做同款! </dd> <dd class="cont2">4865次使用</dd> </dl> </li> <li> <a href="/ai/13107.html" target="_blank" title="UniScribe - AI 免费在线音视频转文字平台" class="img_box"> <img src="/uploads/ai/20260616/uniscribe-icon-3c88366a15.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="UniScribe - AI 免费在线音视频转文字平台" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13107.html" class="aBlack" target="_blank" title="UniScribe">UniScribe</a></dt> <dd class="cont1 lineTwoOverflow"> UniScribe 是一款 AI 音视频转文字与内容整理工具,支持上传音频、视频文件或粘贴 YouTube 链接,自动生成转写文本、摘要、思维导图和关键问题,并支持多格式导出,适合会议记录、课程学习、访谈整理和内容创作复盘。 </dd> <dd class="cont2">4816次使用</dd> </dl> </li> <li> <a href="/ai/13106.html" target="_blank" title="剧云 - 免费 AI 智能中文剧本创作平台" class="img_box"> <img src="/uploads/ai/20260615/d36c7176-icon-2b0cd581ce.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="剧云 - 免费 AI 智能中文剧本创作平台" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13106.html" class="aBlack" target="_blank" title="剧云">剧云</a></dt> <dd class="cont1 lineTwoOverflow"> 剧云是专业中文剧本创作平台,安全稳定运行十余年,集成AI编剧、剧本医生审核、人物小传、剧情关系图、大纲编写、多人协作、Word导入导出、版权管控功能,数据安全防护,轻松高效创作剧本。 </dd> <dd class="cont2">5061次使用</dd> </dl> </li> <li> <a href="/ai/13105.html" target="_blank" title="万象有声 - AI 一站式有声内容创作平台" class="img_box"> <img src="/uploads/ai/20260615/50267bac-icon-c146b001b5.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="万象有声 - AI 一站式有声内容创作平台" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13105.html" class="aBlack" target="_blank" title="万象有声">万象有声</a></dt> <dd class="cont1 lineTwoOverflow"> 万象有声,一个专为有声创作者打造的新一代智能有声内容创作平台。平台提供专业的智能拆章、智能画本编辑、AI配音、AI生成音效、后期制作、智能对轨、智能审听等有声创作全流程工具,可以帮助创作者高效、低成本创作出引人入胜的有声作品。立即体验,让有声书制作更简单! </dd> <dd class="cont2">5020次使用</dd> </dl> </li> </ul> </div> <!-- 相关文章 --> <div class="rightContBox"> <div class="rightTit"> <a href="/articlelist.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit lineOverflow">相关文章</div> </div> <ul class="aboutArticleRList"> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/207000.html" class="aBlack" title="JavaScript函数定义及示例详解">JavaScript函数定义及示例详解</a></dt> <dd> <span class="left">2025-05-11</span> <span class="right">502浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/621422.html" class="aBlack" title="智能体安全引领产业升级——国内AI安全产品市场深度分析">智能体安全引领产业升级——国内AI安全产品市场深度分析</a></dt> <dd> <span class="left">2026-08-21</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/619053.html" class="aBlack" title="CSS变量简化按钮悬停效果技巧">CSS变量简化按钮悬停效果技巧</a></dt> <dd> <span class="left">2026-05-31</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/618916.html" class="aBlack" title="JavaScript符号类型详解与应用">JavaScript符号类型详解与应用</a></dt> <dd> <span class="left">2026-05-31</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/612539.html" class="aBlack" title="HTML剪贴板复制粘贴怎么用">HTML剪贴板复制粘贴怎么用</a></dt> <dd> <span class="left">2026-05-26</span> <span class="right">501浏览</span> </dd> </dl> </li> </ul> </div> </div> </div> <div class="footer"> <div class="footerIn"> <div class="footLeft"> <div class="linkBox"> <a href="/about/1.html" target="_blank" class="aBlack" title="关于我们">关于我们</a> <a href="/about/5.html" target="_blank" class="aBlack" title="免责声明">免责声明</a> <a href="#" class="aBlack" title="意见反馈">意见反馈</a> <a href="/about/2.html" class="aBlack" target="_blank" title="联系我们">联系我们</a> <a href="/send.html" class="aBlack" title="广告合作">内容提交</a> <a href="/manual/go/" target="_blank" class="aBlack" title="手册">手册</a> </div> <div class="footTip">Golang学习网:公益在线Go学习平台,帮助Go学习者快速成长!</div> <div class="shareBox"> <span><i class="qq"></i>技术交流群</span> </div> <div class="copyRight"> Copyright 2023 http://www.17golang.com/ All Rights Reserved | <a href="https://beian.miit.gov.cn/" target="_blank" title="备案">湘ICP备19018815号-4</a> </div> </div> <div class="footRight"> <ul class="encodeList"> <li> <div class="encodeImg"> <img src="/assets/examples/qrcode_for_gh.jpg" alt="Golang学习网"> </div> <div class="tit">关注公众号</div> <div class="tip">Golang学习网</div> </li> <div class="clear"></div> </ul> </div> <div class="clear"></div> </div> </div> <!-- 微信登录弹窗 --> <style> .popupBg .n-error{ color: red; } </style> <div class="popupBg"> <div class="loginBoxBox"> <div class="imgbg"> <img src="/assets/images/leftlogo.jpg" alt=""> </div> <!-- 微信登录 --> <div class="loginInfo encodeLogin" style="display: none;"> <div class="closeIcon" onclick="$('.popupBg').hide();"></div> <div class="changeLoginType cursorPointer create_wxqrcode" onclick="$('.loginInfo').hide();$('.passwordLogin').show();"> <div class="tip">密码登录在这里</div> </div> <div class="encodeInfo"> <div class="tit"><i></i> 微信扫码登录或注册</div> <div class="encodeImg"> <span id="wx_login_qrcode"><img src="/assets/examples/code.png" alt="二维码"></span> <!-- <div class="refreshBox"> <p>二维码失效</p> <button type="button" class="create_wxqrcode">刷新1111</button> </div> --> </div> <div class="tip">打开微信扫一扫,快速登录/注册</div> </div> <div class="beforeLoginTip">登录即同意 <a href="#" class="aBlue" title="用户协议">用户协议</a> 和 <a href="#" class="aBlue" title="隐私政策">隐私政策</a></div> </div> <!-- 密码登录 --> <div class="loginInfo passwordLogin"> <div class="closeIcon" onclick="$('.popupBg').hide();"></div> <div class="changeLoginType cursorPointer create_wxqrcode" onclick="$('.loginInfo').hide();$('.encodeLogin').show();"> <div class="tip">微信登录更方便</div> </div> <div class="passwordInfo"> <ul class="logintabs selfTabMenu"> <li class="selfTabItem loginFormLi curr">密码登录</li> <li class="selfTabItem registerFormBox ">注册账号</li> </ul> <div class="selfTabContBox"> <div class="selfTabCont loginFormBox" style="display: block;"> <form name="form" id="login-form" class="form-vertical form" method="POST" action="/index/user/login"> <input type="hidden" name="url" value="//www.17golang.com/article/610850.html"/> <input type="hidden" name="__token__" value="ba1ec9d057f0539397e361be62dbaa87" /> <div class="form-group" style="height:70px;"> <input class="form-control" id="account" type="text" name="account" value="" data-rule="required" placeholder="邮箱/用户名" autocomplete="off"> </div> <div class="form-group" style="height:70px;"> <input class="form-control" id="password" type="password" name="password" data-rule="required;password" placeholder="密码" autocomplete="off"> </div> <div class="codeBox" style="height:70px;"> <div class="form-group" style="height:70px; width:205px; float: left;"> <input type="text" name="captcha" class="form-control" placeholder="验证码" data-rule="required;length(4)" /> </div> <span class="input-group-btn" style="padding:0;border:none;"> <img src="/captcha.html" width="100" height="45" onclick="this.src = '/captcha.html?r=' + Math.random();"/> </span> </div> <div class="other"> <a href="#" class="forgetPwd aGray" onclick="$('.loginInfo').hide();$('.passwordForget').show();" title="忘记密码">忘记密码</a> </div> <div class="loginBtn mt25"> <button type="submit">登录</button> </div> </form> </div> <div class="selfTabCont registerFormBox" style="display: none;"> <form name="form1" id="register-form" class="form-vertical form" method="POST" action="/index/user/register"> <input type="hidden" name="invite_user_id" value="0"/> <input type="hidden" name="url" value="//www.17golang.com/article/610850.html"/> <input type="hidden" name="__token__" value="ba1ec9d057f0539397e361be62dbaa87" /> <div class="form-group" style="height:70px;"> <input type="text" name="email" id="email2" data-rule="required;email" class="form-control" placeholder="邮箱"> </div> <div class="form-group" style="height:70px;"> <input type="text" id="username" name="username" data-rule="required;username" class="form-control" placeholder="用户名必须3-30个字符"> </div> <div class="form-group" style="height:70px;"> <input type="password" id="password2" name="password" data-rule="required;password" class="form-control" placeholder="密码必须6-30个字符"> </div> <div class="codeBox" style="height:70px;"> <div class="form-group" style="height:70px; width:205px; float: left;"> <input type="text" name="captcha" class="form-control" placeholder="验证码" data-rule="required;length(4)" /> </div> <span class="input-group-btn" style="padding:0;border:none;"> <img src="/captcha.html" width="100" height="45" onclick="this.src = '/captcha.html?r=' + Math.random();"/> </span> </div> <div class="loginBtn"> <button type="submit">注册</button> </div> </form> </div> </div> </div> <div class="beforeLoginTip">登录即同意 <a href="https://www.17golang.com/about/3.html" target="_blank" class="aBlue" title="用户协议">用户协议</a> 和 <a href="https://www.17golang.com/about/4.html" target="_blank" class="aBlue" title="隐私政策">隐私政策</a></div> </div> <!-- 重置密码 --> <div class="loginInfo passwordForget"> <div class="closeIcon" onclick="$('.popupBg').hide();"></div> <div class="returnLogin cursorPointer" onclick="$('.passwordForget').hide();$('.passwordLogin').show();">返回登录</div> <div class="passwordInfo"> <ul class="logintabs selfTabMenu"> <li class="selfTabItem">重置密码</li> </ul> <div class="selfTabContBox"> <div class="selfTabCont"> <form id="resetpwd-form" class="form-horizontal form-layer nice-validator n-default n-bootstrap form" method="POST" action="/api/user/resetpwd.html" novalidate="novalidate"> <div style="height:70px;"> <input type="text" class="form-control" id="email" name="email" value="" placeholder="输入邮箱" aria-invalid="true"> </div> <div class="codeBox" style="height:70px;"> <div class="form-group" style="height:70px; width:205px; float: left;"> <input type="text" name="captcha" class="form-control" placeholder="验证码" /> </div> <span class="input-group-btn" style="padding:0;border:none;"> <a href="javascript:;" class="btn btn-primary btn-captcha cursorPointer" style="background: #2080F8; border-radius: 4px; color: #fff; padding: 12px; position: absolute;" data-url="/api/ems/send.html" data-type="email" data-event="resetpwd">发送验证码</a> </span> </div> <input type="password" class="form-control" id="newpassword" name="newpassword" value="" placeholder="请输入6-18位密码"> <div class="loginBtn mt25"> <button type="submit">重置密码</button> </div> </form> </div> </div> </div> </div> </div> </div> <script src="/assets/js/juejin-theme.js?v=20260613b" defer></script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?e34c3e8ab31ba35d7e1c48ea8d77315f"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script src="/assets/js/frontend/common.js"></script> </body> </html>