How to allow copy and paste from an ionic webview?

你。 提交于 2019-12-09 15:55:12

问题


I am using ionic and cordova to build a hybrid application.

However, I can't copy text from any of my webviews. From my Android phone or from the browser, copying text does not work. Selecting text and dragging the pointer does nothing.

This occurs for instance with the basic app generated by ionic start myApp tabs.

Simply put, how can I allow users to copy-paste?


回答1:


Make ion-content to overflow-scroll="true" and add a class to your copyable text

.selectable{
    -webkit-user-select: auto;
}

You cannot copy anything to clipboard from javascript for now programmatically. However it can be done from native side via plugin CordovaClipboard




回答2:


You can try with console.log() and copy/paste from the console.

Or if you need to copy from an emulator you can use Remote debugging



来源:https://stackoverflow.com/questions/22893173/how-to-allow-copy-and-paste-from-an-ionic-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!