marinemerchant
Newbie
- Aug 8, 2009
- 11
- 14
For those who do not have godcpa (I actually don't prefer how he handles redirects though), here is a script to get you started if you want to redirect on submit a form loaded in an iframe. I found history.length to be unreliable because you can't control their history.length unless you popup a new window (and risk pop blocked).
Need more information? Read this http://www.blackhatworld.com/blackhat-seo/cloaking-content-generators/88007-iframing-closing-iframe-after-submit.htmlthat started this script. Problem with the script at the bottom of that post is it doesn't check how many pages (redirects) loaded in the iframe.
- Paste/merge the script code into your iframe page
- Remove // from alert(k);
- Call the function iFrame() using onload= in your iframe tag
- Alert will popup telling you what # k is a few times. When it is done add 1 to that #. (In my case k was 4, so add 1 is 5)
- See (k!=5) and (k==5), good now change my 5 to whatever your # was (after you added 1)
- Add // back to alert(k); b/c it's annoying
- Change thankyou.php (you can load pages or URL) and/or 3000 (this is how long to wait for redirect in milliseconds)
Code:
<script type='text/javascript'>
var k=1;
function iFrame()
{
if(k!=5)
{
k=k+1;
//alert(k);
if(k==5)
{
window.setTimeout('window.location="thankyou.php"; ',3000);
}
}
}
</script>