Link to home
Start Free TrialLog in
Avatar of chipsterva69
chipsterva69

asked on

Retrieve parent document value from iFrame

Working on a solution for a Sitecore CMS page that includes passing a variable from the parent page to an VBScript ASP page in an iFrame.  The code I currently have in the parent page is:
<script>
    var locationID = '@Model.IgnitionID';
    document.write(locationID);
</script>

Open in new window


And the code in the receiving iFrame page is:
<%
Dim barkBark
barkBark = ("#locationID", top.document)
%>

...later in the code...
<p>Location ID: </p>
<%response.Write(barkBark) %>

Open in new window


I know the parent page code works - the document.write shows the correct code.

When I run the code as-is, I get an 'expected ')' message, with the prompt to put it after "#locationID".  I have tried adding it there, nesting it another set of parens, changing top.document to parent.document.body.  The anticipated value is a GUID.

Any help is greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chipsterva69
chipsterva69

ASKER

@Julian Hansen - thanks for the input.  I tried getting the code you recommended to work, but as you pointed out, security prevents direct interaction.  However, we were able to create a solution that added the necessary ID to the URL being passed to the iFrame and were able to resolve the issue that way.  Thanks for the suggestion!
While the original recommended code did not workout, the input offered led to the eventual solution.