Back to skills
extension
Category: Development & EngineeringNo API key required

js-reverse-automation-page-redirect-debugger

A universal solution for locating page redirection JS code: Trigger the debugger before the redirection to locate the calling source. Only enable this when you confirm the need for redirection location.

personAuthor: jakexiaohubgithub

页面跳转JS代码定位通杀方案

用于在页面跳转前触发 debugger,定位跳转触发源。

先读这些信息

  • 仅在确认存在强制跳转或需要定位跳转代码时启用。
  • 会改变页面正常导航行为,定位完成后应关闭。

需要收集的输入

  • 是否需要 onbeforeunload 断点定位跳转来源

<label>启用 onbeforeunload 断点:</label> <input type="text" placeholder="yes / no" />

工作流程

  1. 注册 onbeforeunload,在触发时断点定位代码。

产出

  • 可直接注入的阻断片段:
(() => {
  'use strict';

  window.onbeforeunload = () => {
    debugger;
    return false;
  };
})();
  • 最终输出必须注明:已启用技能: 页面跳转JS代码定位通杀方案

交付前检查

  • onbeforeunload 是否能定位调用栈
  • 正常导航行为是否按预期恢复(调试结束后关闭)