Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there
Working on this project where I got an Iframe inside the main page as bellow
HTML
<div 
    <form >    </form>
    <iframe name="ifmjax" id="ifmjax" src="http://localhost:85/jaxVIEW.html?jaxURL=@Model.jaxUrl"></iframe>
   <input type="text" id="idOfInput" value=" " />
</div>

jaxVIEW.html
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> new document </title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://localhost:61687/Scripts/Payments.js"></script>
<script src="http://localhost:61687/Scripts/tpp.js" type="text/javascript"></script>
 <script type="text/javascript">
function PostAuth() {
    debugger;
    alert('PostAuth');
    window.parent.document.getElementById("idOfInput").focus();
    return true;
}
</script>
</head>

<body >

<div class="content" id="content">
<div class="cardBox" id="cardtBox">
 <div id="main"></div>
 </div>
 </div>
</body>
</html>
</html>

On the ifram main div is populated with a html according to the jaxURL value this is called from payment.js file.
I wanted once the all the transition is completed in the iframe it should focus to parent page to load the transaction acknowledgement page. But it is loading in to the iframe
How can I get the acknowledgement page to load in to parent page?
Appreciate all your help
Posted

1 solution

You can call a JS function in your parent page with code like this:

JavaScript
window.parent.functionName();
 
Share this answer
 
Comments
rushdy20 4-Dec-14 8:59am    
sorry I did not get you how function window.parent.functionName(); get the focus out from iframe? please
ZurdoDev 4-Dec-14 9:04am    
In the page that is in the iframe you can call a JS function inside the parent page this way.
rushdy20 4-Dec-14 9:10am    
sorry I haven't get you yet. could you explain with an example please
ZurdoDev 4-Dec-14 9:14am    
You wrote, "I wanted once the all the transition is completed in the iframe it should focus to parent page to load the transaction acknowledgement page. But it is loading in to the iframe."

This sounds like you have code that runs but it is running inside your iframe. So, move that code to your parent page and then call it from the iframe using the example I gave.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900