Code Monkey home page Code Monkey logo

webdebugger's Introduction

项目建立的原因

很多情况下,无法使用调试器,比如微信的浏览器,或者其他ios下一些第三方浏览器
这些浏览器并不开启webview的调试,无法使用 Mac Safari或者 Chrome://insepect 进行调试
所以需要一种手段对页面进行调试

目前想到的方案

  1. 建立一个客户端脚本,需要调试页面的时候,加上如下脚本:
<script async="async" data-wdserver="192.168.0.168:8888" src="webdebugger.js"></script>

可配置的参数:
data-wddelay:调试器重连的延迟时间
data-wdserver:要连接的远程服务器地址

  1. 脚本启动时,检查是否可以使用websocket连接data-wdserver的服务器
  2. 连接成功后,提交 referer user-agent等信息
  3. 服务端可以发送指令到客户端
  4. 客户端接收到信息后,使用如下代码执行
function debugger(serverMsg){
    try{
        var result=eval(serverMsg);
    }catch(e){
        var error = e;
    }
    return {result,error}
}

将结果数据序列化后,回发给服务端,服务端在控制台进行打印

webdebugger's People

Contributors

eos3tion avatar

Watchers

James Cloos 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.