I have an iframe on my first page and am redirecting the frame to second page on my second page I am using javascript to jump out of iframe as follow :
<script language="JavaScript" type="text/javascript">
<!--
function breakout_of_frame() {
if (top.location != location) {
top.location.href = document.location.href;
}
}
-->
</script>
My problem is that this will make the page run several times and my code in load event will execute (say if i am sending email on load will send three times).
Now I have tried using boolean values to see when email is sent set it to true and dont send if false…but it still will not work. any suggestions to prevent this from happening?
A simple, rough and ready solution:
On your following request, append something to the query string of your request to identify the difference between the two pages.
When you read document.location.href, parse it for the differing element and react accordingly.
for example:
your-domain/your-path/your-file?donealready=yes