Hi all,
I want to accomplish a functionality that will insert data in my database when user enters some data in a form loaded from other domain in an iframe of my web page. Is it possible to do this? any help would be great.
Thanks & Regards
Niranjan
Cross Domain Communication
Moderator: General Moderators
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Cross Domain Communication
No, it is not possible.
What are you trying to achieve?
What are you trying to achieve?
Re: Cross Domain Communication
Actually, it IS possible, by a couple different methods:
(1) If the remote domain adds YOUR url into it's action statement on the form (e.g. "<form name='somename' ... action='http://www.example.com/mypage.php'>")
(2) use JavaScript to look inside the iFrame, copy all of the names and values of each field in the form into an array, then use AJAX to pass that information off to your url
(3) just like #2, only use JavaScript to re-create the form in the iFrame onto your page, then submit that form to your own url
But I am curious as well: what are you trying to achieve? It seems a little... mischievous....
(1) If the remote domain adds YOUR url into it's action statement on the form (e.g. "<form name='somename' ... action='http://www.example.com/mypage.php'>")
(2) use JavaScript to look inside the iFrame, copy all of the names and values of each field in the form into an array, then use AJAX to pass that information off to your url
(3) just like #2, only use JavaScript to re-create the form in the iFrame onto your page, then submit that form to your own url
But I am curious as well: what are you trying to achieve? It seems a little... mischievous....
Re: Cross Domain Communication
you can not modify iframe if it is not the same domain and port because of same origin policy
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Cross Domain Communication
Nope.rburgens wrote:Actually, it IS possible
1) He said it's a form from other domain.
2) As arjan.top said, SOP.
3) ^^