yarek
yarek

Reputation: 12064

chrome extension : can extension communicate with external iframe?

Mu my chrome extension is infact a simple EXTERNAM iframe.

<iframe src="http://www.example.com/index.php"></iframe>

My goal is that index.php (inside the iframe)can modify

chrome.browserAction.setBadgetText

Is such thing possible with external Iframe ?

reagrds

Upvotes: 1

Views: 195

Answers (1)

Xan
Xan

Reputation: 77571

You can do so with messaging. A more detailed answer is here, but in a nutshell:

  1. You need to add example.com as an appropriate pattern to "externally_connectable" in the manifest.
  2. You need to add code to example.com page that sends a message to the extension.
  3. In your extension's background script, you need to set up a listener for that message, and perform needed operations with it.

Upvotes: 2

Related Questions