Click here to Skip to main content
15,885,886 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
but it return empty alert box.. pls anyone help me. I need alertbox with detail of iframe src(address location, http://www.google.com) value.

JavaScript
<iframe width="700px" height="900px" name="ifrm" id="ifrm" onload="load()"></iframe> 

<script type="text/javascript">
function load()
{
var oIframe = document.getElementById("ifrm");

var oDoc = oIframe.contentWindow || oIframe.contentDocument;

if (oDoc.document) {

    oDoc = oDoc.document;
}
alert(oDoc.ifrm.href);
}
</script>
Posted

1 solution

It is a Same Origin Policy[^] violation. You will not be able to look inside the iframe document.
 
Share this answer
 
Comments
hari301 8-Mar-13 3:21am    
is there any other way to access the content?
Zoltán Zörgő 8-Mar-13 3:36am    
Sorry, not really.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900