V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
overlords
V2EX  ›  问与答

请问 chrome 插件如何获取页面中 JS 变量

  •  
  •   overlords · Jan 17, 2015 · 8687 views
    This topic created in 4124 days ago, the information mentioned may be changed or developed.
    想通过chrome插件来获取页面中JS变量的值;请问处理过的V友指点一二;
    3 replies    2017-05-02 15:29:55 +08:00
    14ly
        1
    14ly  
       Jan 17, 2015
    var e=document.createElement("script");
    e.innetHtml="//把要读的JS 变量存到dom里"
    e.setAttribute("charset","utf-8")
    document.body.appendChild(e)
    youke
        2
    youke  
       Apr 5, 2016
    @14ly 能说清楚点吗?试了,没用了。我在 console 可以获取,怎么在 content_script.js 里面用 window.document.defaultView.xxx 获取不到
    mathcoder23
        3
    mathcoder23  
       May 2, 2017
    直接复制当然没有用,别个故意发错误的属性。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1195 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:10 · PVG 01:10 · LAX 10:10 · JFK 13:10
    ♥ Do have faith in what you're doing.