[SOLVED] Embedded web chat can't receive any messages

Hi, I’ve been trying to embed a Twitch chat window on my website, and I can successfully connect my Twitch account and send messages, but I don’t receive any messages at all. I’ve confirmed this by having the same channel chat open on the main Twitch.tv website and I can see my own messages being sent to the channel.

I see the following errors from Google Chrome, would it be related?

Uncaught SecurityError: Blocked a frame with origin “http://www.twitch.tv” from accessing a frame with origin “http://www.pokemonrealtime.com.usrfiles.com”. The frame requesting access set “document.domain” to “twitch.tv”, but the frame being accessed did not. Both must set “document.domain” to the same value to allow access.t.default.Instrumentation.subscribe.after @ emberchat-5adff9118db163bbca272d91c2293158.js:32(anonymous function) @ emberchat-5adff9118db163bbca272d91c2293158.js:6V @ emberchat-5adff9118db163bbca272d91c2293158.js:7i @ emberchat-5adff9118db163bbca272d91c2293158.js:6i.default.defineModel.setHostMode @ emberchat-5adff9118db163bbca272d91c2293158.js:34(anonymous function) @ emberchat-5adff9118db163bbca272d91c2293158.js:34(anonymous function) @ global-b109f1a01daeb967794b7fc48447c97b.js:15f @ global-b109f1a01daeb967794b7fc48447c97b.js:15l.fireWith @ global-b109f1a01daeb967794b7fc48447c97b.js:15i.(anonymous function) @ global-b109f1a01daeb967794b7fc48447c97b.js:15(anonymous function) @ tmi-v3.rd56974791049e4c4aaa8482ac4b4922a02063671.js:2f @ global-b109f1a01daeb967794b7fc48447c97b.js:15l.fireWith @ global-b109f1a01daeb967794b7fc48447c97b.js:15i.(anonymous function) @ global-b109f1a01daeb967794b7fc48447c97b.js:15f @ global-b109f1a01daeb967794b7fc48447c97b.js:15l.fireWith @ global-b109f1a01daeb967794b7fc48447c97b.js:15x @ global-b109f1a01daeb967794b7fc48447c97b.js:16t @ global-b109f1a01daeb967794b7fc48447c97b.js:16
global-b109f1a01daeb967794b7fc48447c97b.js:30 TMI.js [irc] WARNING: Could not parse IRC message: CAP.
global-b109f1a01daeb967794b7fc48447c97b.js:30 TMI.js [irc] WARNING: Could not parse IRC message: GLOBALUSERSTATE.
global-b109f1a01daeb967794b7fc48447c97b.js:30 TMI.js [irc] WARNING: Could not parse IRC message: 353.
global-b109f1a01daeb967794b7fc48447c97b.js:30 TMI.js [irc] WARNING: Could not parse IRC message: 366.
global-b109f1a01daeb967794b7fc48447c97b.js:30 TMI.js [irc] WARNING: Could not parse IRC message: CAP.
global-b109f1a01daeb967794b7fc48447c97b.js:30 TMI.js [irc] WARNING: Could not parse IRC message: GLOBALUSERSTATE.

How are you trying to embed the chat? What code are you using?

The exact reason why it’s not working is almost definitely related to the error:
"Uncaught SecurityError: Blocked a frame with origin “http://www.twitch.tv from accessing a frame with origin “http://www.pokemonrealtime.com.usrfiles.com”. The frame requesting access set “document.domain” to “twitch.tv”, but the frame being accessed did not. Both must set “document.domain” to the same value to allow access.t.default.Instrumentation.subscribe.after …"

None of those errors seem unexpected to me. Do you have a demo or further debugging steps?

I embed the chat exactly as it states in the documentation, with an iframe:

https://github.com/justintv/Twitch-API/blob/master/embedding.md#chat

My website is hosted by Wix.com and their website editor. I do know that all of their user-customizable JavaScript code lives within an iframe running under the domain yourdomain.com.usrfiles.com

However, I specify just yourdomain.com in the Twitch redirect URI. Would this be the cause of the cross-domain errors? I did see in the Twitch chat JavaScript that it does window.parent in a few places.

My demo can be seen at www.pokemonrealtime.com

What’s strange is that it has worked fine once or twice and I would receive messages, but now I can’t seem to get it to work again, and I haven’t changed any code.

Please make sure to use the lowercase version of the name: papaplatte, not Papaplatte. If you’re using the API to populate the embeds, use login, not display_name.

1 Like

That solved it! Thank you so much!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.