Chrome extension script doesn't work on 2nd page

16 views
Skip to first unread message

Lee Fixter

unread,
Apr 29, 2015, 8:37:39 AM4/29/15
to chromium-...@chromium.org

I’m building a browser action chrome extension where I’m filling in a login page. After I submit the form I am taken to a 2nd page. How can I continue execution of my script on the new page to fill in the next form that appears?

Reilly Grant

unread,
Apr 29, 2015, 11:23:29 AM4/29/15
to Lee Fixter, chromium-...@chromium.org

You'll need to send any relevant state to your extension's background page so that when the content script is executed on the next page it can read back the data and pick up where the last page left off.


On Wed, Apr 29, 2015, 5:37 AM Lee Fixter <mr.v...@gmail.com> wrote:

I’m building a browser action chrome extension where I’m filling in a login page. After I submit the form I am taken to a 2nd page. How can I continue execution of my script on the new page to fill in the next form that appears?

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/5ace3806-ef5d-4bc4-b67b-c0fdfeeb3643%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Lee

unread,
Apr 29, 2015, 12:14:18 PM4/29/15
to chromium-...@chromium.org
Thanks. So in theory my background.js could fill in the first form, submit the page, store a value to say page 1 processingn done, then when page 2 loads, the same background.js will be loaded. Which means I can then read that page 1 is done and then continue processing page 2?

Reilly Grant

unread,
Apr 29, 2015, 12:32:08 PM4/29/15
to Lee, chromium-...@chromium.org

No, there must be two separate scripts. The content script is injected into the page, the background page is part of the extension and always runs in the background while the extension is loaded. You can use  postMessage to send messages between them. Only the content script can modify the form on the page.


On Wed, Apr 29, 2015, 9:14 AM Lee <mr.v...@gmail.com> wrote:
Thanks. So in theory my background.js could fill in the first form, submit the page, store a value to say page 1 processingn done, then when page 2 loads, the same background.js will be loaded. Which means I can then read that page 1 is done and then continue processing page 2?

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.

Lee

unread,
Apr 29, 2015, 12:40:05 PM4/29/15
to chromium-...@chromium.org
At the moment it is the background script that is modifying the form...
Reply all
Reply to author
Forward
0 new messages