Code Monkey home page Code Monkey logo

page-redirect-code-location-hook's Introduction

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

一、原理概述

  1. 通过window.onbeforeunload事件下一个断点,阻断跳转使其留在当前页面
  2. 追栈,上一个栈帧就是跳转逻辑,秒定位。

二、案例 https://www.agefans.cc

这个网站在播放页面打开开发者工具会跳转到首页,来定位一下它,先打开一个空白的标签页,然后粘贴网址:
https://www.agefans.cc/play/20190169?playid=2_1 然后按F12打开开发者工具,页面在跳转之前进入了断点: 然后追调用栈,上一个栈帧就是跳转逻辑:

三、注意

检测开发者工具是否打开的方式有很多,检测到打开之后重定向到某个页面只是一个应对行为,此工具只是用来解决一个很窄的情况。

检测到之后重定向并不是一个好的应对行为,因为笔者注意到之前收藏的几个检测到后重定向的网站都改为了检测之后不再重定向而是其他应对策略。

四、其它

本项目自项目https://github.com/CC11001100/crawler-js-hook-framework-public迁移至此,原项目太多内容放在一个项目里,因此分发为多个小项目。

page-redirect-code-location-hook's People

Contributors

cc11001100 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.