1,HTML source code£º <html> <head> <title>How to use SecurityException</title> </head> <body> <script src="jsjava.js"></script> <script> function getIFrameBodyContent(frameName){ var content; try{ content=eval(frameName).document.body.innerHTML; }catch(e){ throw new SecurityException(SecurityException.ERROR,"Can not access document object in another domain"); } } function calculate(){ var content; try{ content=getIFrameBodyContent('google'); }catch(e){ document.write(e.message); } } </script> <iframe name="google" src="http://www.google.cn"></iframe> <br> <input type="button" value="load iframe document" onclick="calculate()"> </body> </html> 2,The display text is:

Can not access document object in another domain