Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Below is my manifest.json:
{

 "name": "My Extension Name",

 "version": "1.9.1",

 "manifest_version": 2,

 "icons": {  "16": "icon16.png",

             "48": "icon48.png",

             "128": "icon128.png" },

 "homepage_url": "https://www.mysite.com",

 "description": "My Extension Description",

 "permissions": ["http://www.example.com/*"],

 "content_scripts" : [{

         "matches" : [ "http://www.example.com/*"],

         "js" : ["contentscript.js"],

         "run_at" : "document_end"

  }],

        "web_accessible_resources": ["script.js"]

}

My contentscript.js is:

var s = document.createElement('script');

s.src = chrome.extension.getURL("script.js");

(document.head||document.documentElement).appendChild(s);

script.js:

$.post("https://www.mysite.com/app/myfolder/", function(html){

  $("body").prepend(html);

});

I would like to access the DOM in http://www.example.com/. There is a form in http://www.example.com/. when the submit button of the form is clicked, iw ould like to get the post values in www.mysite.com. How to achieve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
270 views
Welcome To Ask or Share your Answers For Others

1 Answer

Yes, you can intercept, process, and tamper with a site's POST data using the chrome.webRequest interface. Just implement webRequest in your manifest.json and add an onBeforeSendHeaders function in your content-script. More documentation can be found on the Google Chrome Extension Developers Documentation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...