Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Framekiller killer: redirect framekiller to frame

I built a HTML+JS app which I use for my own mystical reasons. This thing uses IFrame to display webpages in the middle of the application. I implemented a simple framekiller killer:

window.onbeforeunload = function(e){
  e.preventDefault();
  e.stopPropagation();
  return false;
}

Which, generally, works fine. The problem is that some sites, upon form submission, desperately try to break out of the frame's constraint which is blocked by frame killer. As a side effect, I am unable to submit such forms without killing the app.

Is it somehow possible, to force the sites I display, to aim their form submission at the iframe, not the very top of the display tree?

like image 935
Maurycy Avatar asked Dec 13 '25 01:12

Maurycy


1 Answers

All you need to do is access the form element you wish to change and set the forms target to point to your iframe. So for example

<script>
    function changeToIframe() {
        var tmp =document.getElementById('form_id_to_change');
        tmp.setAttribute("target","my_iframe"); 
    }
</script>
like image 79
Spider Avatar answered Dec 15 '25 22:12

Spider



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!