Disabling / opening an iframe in a new window

I have an iframe setting on the page, and I want to know if it is possible to have a button in this iframe, and when clicked, it opens the iframe in a new browser window, showing the contents of the iframe.

I plan to use either JavaScript or jQuery to achieve this. I am using IE6.

+3
source share
2 answers
$('.button').click( function(){
    window.open($('iframe').attr('src'),'mywindow','width=400,height=200');
});
+5
source

Why do you need to (open the same page on which this button is), regardless of whether it is an iframe or if on the home page.

, , , , , .

, :

$("#mybuttonOpenWin").click(function(){
   window.open(window.location.href);
});

, :

$("#mybuttonOpenWin").click(function(){
   var mref = window.open(window.location.href);

   (function = onReadyRef(xref){
      if(xref.window.document.readyState=="complete"){
        $(xref.window.document).find("body").html($("body").html());
      }
      else{
         onReadyRef.call(this, xref);
      }
   })(mref);
});
0

Source: https://habr.com/ru/post/1725792/


All Articles