I’m trying to incorporate web intents in a chrome extension.

When the user clicks the tweet/retweet/favorite button in the widget’s popup, the twitter action happens but the callback is not fired and the pop up window does not close.

The widget throws this message:
TWITTER: Please note: Not all embedded timeline and embedded Tweet functionality is supported when CSP is applied

Is there a way to make web intents work fully with chrome extensions?

You should be able to suppress the CSP warning by adding to the parent document.

If you are using web intent anchors without the platform.twitter.com/widgets.js JavaScript loaded on the page then I don’t expect any JavaScript events to fire.

Thanks Niall,

I am using this meta tag and the widgets.js script is loaded and does run.

Again, the expected behaviour after clicking the, say, retweet button happens but does not complete: The popup window opens, the tweet is retweeted, but the popup window does not close and the callback is not fired.

When I load the same code directly and not from within the extension, everything works smoothly.

Any clue?

Hi Tammynka,

Can you share the code you’re using to invoke the intent? Events will only get passed back if the pop-up has a reference to a parent window. In a normal web page that naturally gets created, but might not when invoked from an extension. We might be able to figure out a workaround.

The CSP error in this case is separate, and doesn’t have concern the Web Intents themselves.

Ben

Hi Ben,

I am using this code to invoke an intent (in this case, for a Favorite button):

The web intent pop-up window’s URL contains an additional parameter, original_referer, with the path to my original HTML (chrome-extension://{{my.extension.id}}/{{path.to.referer.html}}).

It might also be beneficial to note that the Click listener for the twttr object works, and DOES fire the callback after the user clicks on the Favorite button.

Thanks,
Tammy.