I have a parent jsp called p1.jsp . When i click on a link on this jsp , it opens up an iframe called iframe.jsp. Now there is a link in iframe.jsp, which when clicked it must navigate the user to another url after closing the iframe modal window, but that url must be opened on the parent session. This means the parent.jsp will be replaced by the contents of the new.jsp.

I fished out a code like this :

```
<script type="text/javascript">
function closeMyModal()
{
//Closing Iframe modal 
window.parent.parent.document.getElementById('ovr1').style.display = 'none';
window.parent.parent.document.getElementById('cnt1').style.display = 'none';
<%
String hamlistVal = request.getParameter("hamlistVal");
%>
//Open the new.jsp on the p1.jsp i.e. relace p1.jsp with new.jsp
window.location.href="<%=com.pack.href.getCamHref()%>&hamlistVal=<%=hamlistVal%>";

}
</script>   

```

My iframe modal is getting closed , but it is not navigating to the new.jsp .
What am i doing wrong here ? Kindly help .