I need help with getting URL of iFrame element in mozilla. While this code works perfectly in IE it does not work in mozilla.
<iframe id="frame" onload="myFunction()" src="./upload/" ></iframe>
<script type="text/javascript" >
   function myFunction()
   {                            
      var a = document.getElementById("frame").contentWindow.location.href;
      alert(a)
   }
</script>
Can you please tell me how to make it work in mozilla ? I don`t need the src of the iframe but changing URL according to iframe location. Webpage and iframe content are both on the same domain.
I found out that these two codes works perfectly only in IE:
document.getElementById("frame").contentWindow.location.href;
document.frames['frame'].location.pathname;
Also location.pathname and location.href without iframe work also in chrome and mozilla. But if i add document.getElementById("frame") or document.frames['frame'] it stops working in chrome and mozilla.
 
    