IE8/IE9 Copy/Cut/Paste doesn't work on cross-domain IFRAME in Showmodaldialog window RRS feed

  • Question

  • I am using showmodaldialog to open a new window. My pop-up window contains an IFRAME which points to cnn.com. When I open this pop-up window cut/copy/paste doesn't work even though these functions are enabled on right-click. I am trying to paste a word from clipboard to CNN.com search textbox.

    It works fine if I open pop-up window in my own domain but doesn't work in cross-domain. I checked all the settings in IE and I couldn't find anything.

    Can someone help me figure out what is the problem?

    Here's a code snippet.



    <script language=javascript>
    function doit()
    var sData = "";
    var sFeatures = "center:yes; dialogHeight: 800 px; dialogWidth: 900 px;";
    var returnvalue = window.showModalDialog("main_frame.html", sData,sFeatures);


    function openit()
    <a href="javascript:doit();">Click This For ShowModalDialog!</a>
    <a href="javascript:openit();">Click This For open!</a>
    <iframe  src='http://localhost/web/f1.html'  ></iframe>



    <table width= "100%" height = "100%" border = "solid">

    <!-- <tr width= "50%" height = "50%">
    <td width= "200px" height = "200px"><iframe  src='http://localhost/web/base/logindisp?tenant=DS_MP_1' ></iframe></td>
    </tr> -->
    <tr width= "50%" height = "50%">
    <td width= "100%" height = "100%"><iframe  src='http://localhost/web/f1.html'  ></iframe></td>
    <td width= "100%" height = "100%"><iframe  src='http://www.cnn.com'  ></iframe></td>

    <tr width= "50%" height = "50%">
    <td width= "100%" height = "100%"><iframe  src='f1.html'  ></iframe></td>




    <input name = 'test'/>
    Ignore this.

    • Edited by Vijay2020 Monday, May 6, 2013 5:57 PM
    Monday, May 6, 2013 5:53 PM

All replies

  • Hi,

    there are security settings for scripted copy/paste.


    Tuesday, May 7, 2013 3:01 AM
  • If you are talking about IE settings "Allow Programmatic clipboard access"  then I have it enabled.


    Friday, May 10, 2013 5:28 PM
  • Same issue here.  Anytime I have a showModalDialog with iframe to another site (even on the same domain  ie: http://site2.mydomain.com) all copy/cut/paste functionality ceases to work for the sites’ textboxes in the window.  The sub menu items copy and past are accessible but do nothing. CTRL C,X,V do nothing. I have lowered the security settings of IE8 to lowest possible and still nothing. Even compatibility mode for IE8 does not solve the problem

    Pre IE8 everything works fine. The only time it works in IE8+ is when the modal dialog contains a page in the same site as the parent.

    If anyone has a solution, please provide insight.

    Thursday, May 23, 2013 12:30 PM
  • I think we should file a bug for this. Looks like this is a bug in IE.

    • Edited by Vijay2020 Thursday, May 30, 2013 4:10 PM
    Thursday, May 30, 2013 4:09 PM
  • http://connect.microsoft.com/ie

    include links to a publicly accessible test harness or mark your post MS only if you do not have a publicly available test case.

    see here http://msdn.microsoft.com/en-us/library/ie/hh673561(v=vs.85).aspx about the new 'sandbox' attribute for iframes in html5 that IE10 introduces.



    • Marked as answer by Yanping Wang Wednesday, June 5, 2013 7:42 AM
    • Unmarked as answer by Vijay2020 Wednesday, December 18, 2013 5:12 PM
    Saturday, June 1, 2013 5:38 AM
  • This doesn't solve my problem. I know it works in < IE7 and > IE9 Where it fails is IE8/IE9

    Wednesday, June 5, 2013 2:38 PM
  • This is not the answer, as the issue refers to IE 8/9 and the answer states "'sandbox' attribute for iframes in html5 that IE10 introduces."
    Wednesday, December 18, 2013 12:09 PM
  • Hi Marius,

    for security reasons, IE10 and 11 still will enforce sandbox attributes even if the web document is not using an Edge rendering mode.


    Friday, December 20, 2013 12:53 AM
  • Thanks Max.

    Thanks Mariius for "This is not the answer, as the issue refers to IE 8/9" 

    They are still talking about IE10 and IE 11 when I am clearly saying that issue is with IE8/IE9.

    Friday, December 20, 2013 10:51 PM
  • Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog.htm

    Neither modal nor modeless HTML dialog boxes support text selection or the standard shortcut menu for copy operations; however, you can imitate this functionality by using script with TextRange objects and event handlers for onmousedown and onmousemove, as in the following example.        

    Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialogLaunch.htm


    there is a ticket at connect about these samples not working because of compatibility changes in IE11.
    Sunday, December 22, 2013 3:47 AM
  • Can someone help me figure out what is the problem?

    The problem is that you are misusing a Dialog for something it wasn't  meant to.

    >> I am using showmodaldialog to open a new window.
    1. The "showModalDialog" method, doesn't open a "new window" - it opens a single instance of a modal Dialog!

    >> My pop-up window contains an IFRAME which points to cnn.com.
    2. Your "pop-up window" is not a popup window! It is a modal Dialog, which is a system|application customizable UI control. Same as alert, prompt or confirm (modal) dialogs.

    >> When I open this pop-up window cut/copy/paste doesn't work...
    3. Of course it doesn't and of course it shouldn't!  Once again, this thingy is not a "popup window", it's a UI control display Dialog, moreover it's not modal but modeless! No UI display Dialog control should allow you to select its UI display, let alone copy/paste it unless you are using a screen capture. - The iframe content allowed purpose is for display only! That is: In case you need to display a user license stored in a separate file to your client, and or change/load the license type according to user selected options linked from another file for display; - not to interact with it, but to simply read and understand it before making a decision! Otherwise, when license content is important for future reference, the programmer will make sure to provide relevant UI controls, sufficient to locally save that license file content with ease. No need to mouse drag, select, ctrl+c, alt+tab to a new text document, ctrl+v, save as ... close, to be able to click back to the application and continue from where you were left.

    In case that you are still wondering, Firefox implements a half-baked imitation of MSIE's original true custom Dialog box reusing an ordinary popup window. That's why it behaves like any other plain document in a plain popup window -but it shouldn't!
    In other words, Firefox doesn't even have true application Dialogs, not even native ones like: prompt, alert or confirm, let alone custom Dialogs and they were simply lazy to disable selection in their native Dialog imitations since it doesn't sport the onselectstart event, wherein programmatically preventing content selection becomes coding nightmare and annoyance or simply bloated and inefficient.


    p.s.: Can anybody explain to me a single sane reason standing behind their decision of misusing an application custom Dialog as a Popup Window; while additionally being aware of the fact that Opera (as one of the 4 most popular UAs ) has never had any support for it?

    Complaining for not being able to misuse a browser application feature! -That's what this is, but "What is wrong with you people?"

    Tuesday, January 28, 2014 9:42 AM
  • Also if its not suppose to do this(allow copy/paste) then it shouldn't allow it in same domain or any version of IE.

    Why it works within same domain and other IE versions? If it should be consistent.

    Tuesday, January 28, 2014 8:43 PM