使用weinre遠端偵錯網頁

來源:互聯網
上載者:User

標籤:

1 下載nodejs並解壓至 nodejsproject/

        http://nodejs.org/download/           


2 安裝weinre
    ./nodejsprojectbin/bin/npm install weinre       #使用nodejs提供的npm 否則會出錯

3 啟動weinre
    ./nodejsproject/node_modules/weinre [someoption]
        options:
        --httpPort     port to run the http server on        default: 8080
        --boundHost    ip address to bind the server to      default: localhost //建議修改為 -all- 監聽所有ip
        --verbose      print more diagnostics                default: false
        --debug        print even more diagnostics           default: false
        --readTimeout  seconds to wait for a client message  default: 5
        --deathTimeout seconds to wait to kill client        default: 3*readTimeout
    (手機和伺服器必須在同一網段,可以相互訪問)

4 調試
    1 手機:訪問 weinre 伺服器, http://xx.xx.xx.xx:8080
    2 手機:在頁面上找到 Target Bookmarklet, 複製下面的js代碼,類似下面的格式 地址後面的anonymous可以修改以方便區分不同手機
            //javascript:(function(e){e.setAttribute("src","http://xx.xx.xx.xx:8080/target/target-script-min.js#anonymous");document.getElementsByTagName("body")[0].appendChild(e);})(document.createElement("script"));void(0);
        可以將js代碼儲存到書籤
    3 手機:開啟新的標籤頁,訪問要調試的網頁 www.aaa.com/1.html
    4 手機:在www.aaa.com/1.html所在的標籤頁點擊我們儲存的書籤,可以將我們的代碼注入到當前頁面,
      或者 直接粘貼js代碼到地址欄,斷行符號 注入代碼
    5 pc端:訪問(wenkit核心的瀏覽器) http://xx.xx.xx.xx:8080
        在access point下訪問 http://xx.xx.xx.xx:8080/client/#anonymous
    6 pc端:在targets 和clients中分別選擇要調試的目標網頁和目標裝置,然後點擊上方的項目選擇調試的項目,操作類似firebug
    
      




使用weinre遠端偵錯網頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.