Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by fugufish

hmm anyone has had this problem before?

- I have domain1.com, with an iframe
- The iframe is loaded with an impactJS game hosted on domain2.com

the game runs perfect, but the error console shows something like

Unsafe JavaScript attempt to access frame with URL http://domain1.com from frame with URL http://domain2.com/game. Domains, protocols and ports must match.


I understand that the domains/ports should be same, but what code in ImpactJS is actually attempting to access cross domain data?

and how do we still host games in an iframe without having this error?

1 decade ago by fugufish

i noticed that facebook iframe apps don't have this problem, due to the fact that we paste a 'cross communication' code provided by facebook. Hmm, does that mean we have to write our own code, and how?

1 decade ago by fugufish

i just read this http://softwareas.com/cross-domain-communication-with-iframes, so it seems like ImpactJS from domain2.com is trying to access window properties in domain1.com

my initial guess would be in the keyboard bind() section, because Impact tries to overwrite the keyboard properties of the window in domain1.com

1 decade ago by fugufish

ok found out the issue

ImpactJS in itself is awesome. I used the soundManager2 plugin, and it uses some cross domain data retrieval to play the sounds.

1 decade ago by Ken

Yes, you can not directly call javascript across domains. It is a security risk. Although there are ways to hack around it and get it to work, as you have seen.

From the iframed page, are you trying to call any functions or reference javascript that is in the parent? I've done this before with Impact without issue. I've even run it 3 deep as well and it's worked fine. Only when trying to reference js from one to the other was there an issue.

Would you mind posting the link for further debug? I understand if not.

1 decade ago by Ken

Ha, ok, nevermind my post, it got crossed in the mail :) Glad you got it solved
Page 1 of 1
« first « previous next › last »