-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the example js-trame cant work. addEventListener on iframe node contentwindow will be stop by CORS #1
Comments
Did you look at that example https://github.com/Kitware/trame-iframe/tree/master/examples/trame-js? Moreover to prevent cross origin issue, you need to be in the same domain. |
Thank you for your reply.I have looked at that example,but it didn't solve my problem. |
It is expected to run across several servers, but people tends to put a proxy in front of it so it all appear to come from a single server. |
I'm also uncertain if I've correctly understood this example. I have tried to run the TRAME server on AWS and set up a temporary Ngrok HTTPS link for testing. Then, from my local computer, I added the link to an iframe. I expected that communication would be bidirectional, but it isn't. While I can successfully send messages from the iframe (on my local PC) to the server, I am not receiving messages back from the server (on slider or button events). |
Which example are you referring to? |
Yes, js-trame @jourdain |
Can you provide more information then, is everything running on the same domain and port? |
No, they are on different domains. Trame server is running on the AWS instance as I mentioned above. Then, I am using ngrok to forward the Trame server (8080) to the internet for testing purposes. Then, I have an iframe with the ngrok URL on my local client. I aim to have a Trame server on an AWS instance and perform bi-directional communication from a web client sitting somewhere else. |
I can successfully send messages from the client to the Trame server on AWS, but I don't see any message when I try to send it from the server back to the client. |
That is expected when you don't share the same domain. You need to put a proxy in front of your services to expose them under the same domain. |
Send message from js to trame is Ok, but when I try to send message from trame to js, it didn't work.
Maybe there's a problem in the example js-trame
it seems that postMessage in iframe should like that
window.parent.postMessage(message)
so at the outside, I can receive message like this:
window.addEventListener
or there is another way to solve this problems?
The text was updated successfully, but these errors were encountered: