1

I want to call a javascript function of parent page where iframe is placed. from the page inside an iframe.

i have tried parent.function_in_parent(); its not working

yes both are in same domain.

for example: there are 5 .net pages page1.aspx,page2.aspx,page3.aspx,page4.aspx,page5.aspx and master.aspx

master.aspx contains the iframe with source page1.aspx, i want to call function abc() written in master.aspx from page1.aspx

cweiske
  • 30,033
  • 14
  • 133
  • 194
madhur
  • 357
  • 2
  • 6
  • 17
  • please post your code. before asking question, do some home work and give as much good information on the problem. so that everbody can understand it. – Ravi Gadag Mar 08 '13 at 06:39
  • 2
    is the iframe source from the same domain or different one – Arun P Johny Mar 08 '13 at 06:39
  • There is also `Same Origin Policy` to consider http://stackoverflow.com/questions/9700766/iframe-call-parent-function – Arun P Johny Mar 08 '13 at 06:40
  • If short, if both the parent and child are from same origin then it should be possible, else `Same Origin Policy` will prevent it – Arun P Johny Mar 08 '13 at 06:42

2 Answers2

1

In short, if both the parent and child are from same origin then it should be possible, else Same Origin Policy will prevent it

Community
  • 1
  • 1
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
0

Check this

Calling a parent window function from an iframe

If your iframe has the different domain to the parent, your work will be a lot more harder. You'll need to see easyXDM

Community
  • 1
  • 1
lngs
  • 690
  • 1
  • 8
  • 17