Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
695
UltraWebGrid.copy() Javascript Exceptions in FireFox
posted

the copy functionality on the client side receives an exception in Firefox the exception is:

 Error: A script from "http://localhost:3803" was denied UniversalXPConnect privileges.

 

Any help would be appreciated.

 

Justin

Parents
No Data
Reply
  • 28464
    posted

    I think, especially for FireFox, clipboard operations are not something that the UltraWebGrid can control internally. FireFox is very strict when it comes to permissions and especially clipboard operations.

    Still, there are some venues you can try. I think the following thread is especially useful:

    http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21269346.html

    [scroll down a lot after the Ads to see the response]

    and especially the generic copy function here:

    function copy_clip(maintext)
    {

     if (window.clipboardData)
       {
      
       // the IE-manier
       window.clipboardData.setData("Text", maintext);
      
       }
       else if (window.netscape)
       {
      
       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
      

       var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
       if (!clip) return;
      

       var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
       if (!trans) return;
      

       trans.addDataFlavor('text/unicode');
      

       var str = new Object();
       var len = new Object();
      
       var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
      
       var copytext=maintext;
      
       str.data=copytext;
      
       trans.setTransferData("text/unicode",str,copytext.length*2);
      
       var clipid=Components.interfaces.nsIClipboard;
      
       if (!clip) return false;
      
       clip.setData(trans,null,clipid.kGlobalClipboard);
      
       }
       alert("Following info was copied to your clipboard:\n\n" + maintext);
       return false;
    }
    //-->

Children
No Data