Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java script in IFRAME security issues

On the website http://imaginaryman-test.blogspot.com/ the typewriter is inside of an IFAME . Everything works correctly on all browsers when you go to the site directly http://castedspell.com/mark/ but when viewing the version embeded in an IFRAME it does not work on IE and throws errors in Chrome.

Unsafe JavaScript attempt to access frame with URL http://imaginaryman-test.blogspot.com/ from frame with URL http://castedspell.com/mark/. Domains, protocols and ports must match.

This is the source code for the embedded IFRAME https://github.com/totheleftpanda/typeWrite/tree/master/mark

I understand that this is a security problem but I don`t know how to fix it and can not find any material that would help me solve the issue.

like image 625
James Andino Avatar asked Mar 04 '26 14:03

James Andino


2 Answers

The easiest method is to set a PHP (or any server language) proxy that just gets the content of the page from the other domain and outputs it. The only real drawback is that the cookies of the client for the remote domain aren't sent.

like image 139
xavierm02 Avatar answered Mar 06 '26 04:03

xavierm02


Take a look at http://benalman.com/projects/jquery-postmessage-plugin/. This is a jquery plugin that sends message between the two frames. The two frames do not need to be on the same domain. But you do need to access both pages to be able modify them. I also wrote a post here that answers communication between iframes. How to capture clicks from iframe on another domain?

like image 25
Amir Raminfar Avatar answered Mar 06 '26 05:03

Amir Raminfar