paste clipboard in marvinview applet

User 01fea90d1a

24-02-2009 17:01:45

Hello





I want to replace the action in js function paste by pasting the content of the clipboard ( a copy from chemdraw or isis draw) instead of inserting the content of a molfile.








<html>


<head>


<script LANGUAGE="JavaScript1.1" SRC="moleditor/marvin.js">


</script>


</head>


<body>


<script>





function paste()

















     document.MView.setM(0,"mrg.mol");





}





mview_name = "MView";


mview_begin("moleditor/", 100, 100);


mview_end();





</script>


Click here to paste structure from drawing program





</body>


</html>


Is it possible or must I use the menu item of marvinview?





MARC

ChemAxon 7c2d26e5cf

25-02-2009 23:25:53

No, it is not possible. Because of security reason, Java does not permit accessing the system clipboard from JavaScript code.








Embedded JavaScript into the web page is not a secure context. If you invoke any Java method from this context, it will be run in untrusted mode. Since retrieving clipboard content (like accessing any file from the local machine) is prohibited in non-secure context, any attempt to access clipboard from JavaScript will have be failed.

User 01fea90d1a

26-02-2009 14:05:05

Is it then possible to launch the paste method via js or via an applet?





I can do that manually by accessing the Edit/Paste menu of marvinview applet.





I just want to access the same method by clicking on html link?





Thanks

ChemAxon 7c2d26e5cf

26-02-2009 14:55:59

There is no method in MarvinView applet API to invoke paste action in MarvinView, programatically. You can do it only manually (Edit/Paste menu).








Thus, there is no way to launch paste process in MarvinView by clicking on a html link on a web page.

User 01fea90d1a

26-02-2009 15:40:26

Thank you for your help