i have an iframe and need to capture the src attribute inside a javascript variable. This is how my iframe looks like
<iframe id="iframe_module_46081" name="iframe_module_46081" src="//myurl.com/tabs/495/campaigns/0ed3ffa8-5050-4a18-a5e3-f348d12a1304?signature=6aa3005368f163539976460246f2f0839c0fb3e3&id=678326">
<script>$(document).ready(function(){
var name = window.name;
var src = ????;
})
</script>
</iframe>
I am able to get the name through window.name but not the src attribute. Any idea?
If allowed by cross-domain checks, try
window.frameElement.src. Otherwise, you are out of luck and left alone withlocation.href.