Skip to content

Instantly share code, notes, and snippets.

@shamasis
Created October 7, 2014 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamasis/8148ccc83e77782cc569 to your computer and use it in GitHub Desktop.
Save shamasis/8148ccc83e77782cc569 to your computer and use it in GitHub Desktop.
Library function to procure text form of clipboard data
var getClipboardDataAsText = (function () {
if (window.clipboardData && window.clipboardData.getData) { // Browsers with global handler
return function () {
return window.clipboardData.getData('Text') || E;
};
}
// For event specific paste supported browsers
return function (referenceEvent) {
return e.clipboardData && e.clipboardData.getData && e.clipboardData.getData('text/plain') || E;
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment