javascript - call a function contain showModalDialog outside iframe show the wrong page -
the site this:
`--main.html `--dialog.html `--folder `--iframe.html and code here:
main.html:
<html> <head> <script type="text/javascript"> function testframe() { var doc = document.getelementbyid("frame").contentwindow; doc.show(); } </script> </head> <body> <iframe src="folder/iframe.html" id="frame"></iframe> <br/> <button onclick="testframe()">test</button> </body> </html> dialog.html:
<html> <head> </head> <body> modal dialog! </body> </html> iframe.html:
<html> <head> <script type="text/javascript"> function show() { showmodaldialog('../dialog.html'); } </script> </head> <body> ifram <br /> <button onclick="show()">show dialog</button> </body> </html> when click show dialog button in ifram,it show modal dialog correctly.
when click test button outside ifram ,it show modal dialog incorrectly.
how can fix when click test button outside ifram show correct page in dilog?
iframedomelement.contentwindow.settimeout(function() { iframedomelement.contentwindow.childfunc(); }, 0); this hack make relative path relative child window. works in firefox , chrome,but not in safari.
Comments
Post a Comment