How can I get the some value from other domain page?
for example
two page from different domain
test.html:
code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<span id="data"></span>
<iframe name="dd" src="http://otherdomain.com/innerpage.html" style="width:600px;height:500px;"></iframe>
</div>
</body>
</html>
innerpage.html(on another domain)
code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function SendDataToParent(){
var dataId = parent.document.getElementById("data"),
data = document.getElementById("iframeData").value;
dataId.innerHTML ="<input type='hidden' value='"+data+"' name='dataFromChildIframe'/>";
}
</script>
</head>
<body>
<div>
<button onclick="SendDataToParent();">SendDataToParent</button>
<input type="text" id ="iframeData" value="some content here">
</div>
</body>
</html>
I want to get input with the id of iframeData value ,and send this value to the parent page
but code don't work ,How to do this?