I used a iframe to display the content from cross domain (this is used for website survey).
But the problem is I couldn't interact with the iframe contents . There are buttons like 'Yes', "No" , but on clicking it nothing happens.
Is it because we are accessing cross domain and the browser prevents accessing?
What is the alternative/solution for this (jquery)?
I can decide the content to be displayed, since it is the survey. I put the questions in the survey website , and it is to be displayed in my website.
Thank you!
answer in order of the questions asked
1) yes see CORS
2) alternatives:
- jsonp (only if the server permits it)
- make a server side proxy
you cant.
cross domain security prevents it.
you would need to use a php page that curl gets the page and displays the contents, and load it then in your iframe so file and container page are from same domain.
Browsers prevent you from accessing cross-domain iframe contents with scripting. You should be able to click on the buttons yourself with your mouse. You cannot, however use any scripts on your site to interact with the contents of the iframe.
Some websites include code to prevent them from being used correctly when embedded inside an iframe. You may want to check if the survey website uses a script like this if you are encountering problems.