简体   繁体   中英

Chrome Extension : How to Get a form and fill and submit it

I am building a chrome extension where I need to get HTML from the website. It has a form which needs to be filled and submitted back.

I click the extension button, pop up opens. I enter details. It fetches me a website which has a form that needs to be filled and submitted back. I currently am using tabs to open the URL, fill the form and submit it back, but I dont want the user to see all the happenings.

I also tried Ajax but not sure how exactly to get HTML, fill the inputs and submit it back.

I tried iFrames but then I get the Unsafe javascript error. Not sure I want to use background page as it will be running in the background always.

Is there any way I can actually make it happen in the background?

Thank You

Simple REST Client is an extension that allows you to do something similar, you can peek into its source to get some ideas.

Also see Chrome Extension Development - POST to new tab as the first answer shows you how to submit a fake form using JS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM