I have no control over anything apart from the iframe.
my form sits in the iframe and I want to grab a variable that comes from the parent link.
Not sure if its poss as the parent url is a different domain.
I cant give live urls, but for example:
www.theredomain.com?ref=variable is the parent url
I need to grab the variable of 'ref' from my iframe which is on a different domain. I have tried the below but it didnt seem to do anything.
<script language="javascript">
function getUrlVars() {
var vars = {};
var parts = window.parent.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
var first = getUrlVars()["ref"];
alert(first);
</script>