I have a javascript function to validate user's input in input or textarea field, I also want to apply these functions on the Iframe's textarea. Is it possible to run the parent's javascript on an iframe with another domain. If yes, how can I do it. Sorry for my newbie question. Thanks in advance
Asked
Active
Viewed 63 times
0
-
is your iframe on the same domain? – Vicky Gonsalves Oct 23 '13 at 07:13
-
post some code so that we can check – Vicky Gonsalves Oct 23 '13 at 07:13
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript – Abhitalks Oct 23 '13 at 07:15
-
possible duplicate of [ – raam86 Oct 23 '13 at 07:18
-
abhitalks has already posted a link explaining the Same-Origin Policy. In some situations there are [some work-arounds](http://stackoverflow.com/a/3076648/1169519) though. – Teemu Oct 23 '13 at 07:18
2 Answers
1
You can't do this as a result of the Same Origin Policy http://en.wikipedia.org/wiki/Same_origin_policy

CamW
- 3,223
- 24
- 34
1
Unfortunately if the source of the iframe is on a different domain you won't be able to interact with the content.

Corey Rothwell
- 394
- 2
- 9