[mapguide-users] Copy coordinates to clipboard

Jérôme DUCKERS jerome.duckers at gmail.com
Tue Jun 2 23:57:08 PDT 2015


Hi Andreotti,

Here i solve the problem like that :

calling a new window :



* function CopytoClipboard(text)      {
window.open("./CopyToClipboard.html?text="+text,'','width=0px,height=0px');
}*


And in this blank window :





















*<html xmlns="http://www.w3.org/1999/xhtml
<http://www.w3.org/1999/xhtml>"><head>    <script>     function
CopyToClipboard()     {        var text = location.search.substring(6,
location.search.length).replace(/%20/g, " ");        var copyDiv =
document.createElement('div');        copyDiv.contentEditable =
true;        document.body.appendChild(copyDiv);        copyDiv.innerHTML =
text;        copyDiv.unselectable = "off";        copyDiv.focus();
document.execCommand('SelectAll');        document.execCommand("Copy",
false, null);        document.body.removeChild(copyDiv);
window.close();    }    </script></head><body onload="CopyToClipboard()">
</body>*
*</html>*


I hope it will help you ;)

Duck.

2015-06-02 21:53 GMT+02:00 Mauricio Villablanca <mgvillablanca at yahoo.com>:

> It's not possible to copy text to the clipboard using javascript. It can be
> done in Flash though.
>
> You might to want create a SWF control in a hidden frame of the Mapguide
> web
> layout and pass the text you want to copy to the clipboard as parameter.
>
>
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Copy-coordinates-to-clipboard-tp5205969p5208742.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20150603/c236d4d6/attachment.html>


More information about the mapguide-users mailing list