Giter VIP home page Giter VIP logo

chrome-demo's Introduction

###介绍 当一个父级页面通过iframe嵌入了一个子级页面时:

  • 如何通过插件设置子级cookie ,

  • 如何通过插件控制子级页面登录,

  • 登录后如何跳转

  • chrome.cookies.getAll 获取的是包括顶级页面的所有cookie

chrome.cookies.getAll({'url':"http://127.0.0.1:8887/ss/zi.html"}, function(cookie) {
        console.log(cookie)
        for(i in cookie) {
            name = cookie[i].name;
            value = cookie[i].value;
            cookie_str += (name + "=" + value + ";\n");
        }
        $('cookie').value = cookie_str;
    })

  • popup chrome的callback 函数并不是同步的,也可能是异步;

  • 关于监听的response

chrome.tabs.sendMessage(tabs[0].id,'message1',function(response) {
            console.log(response);
        })
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
            sendResponse('it is OK!')
        })

sendResponse的信息会再popup那处接受,多个监听事件被一起出发时,返回的response只有一个

chrome-demo's People

Contributors

ricoywang 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.