How to copy text to the client's clipboard using jQuery? [duplicate] - javascript

This question already has answers here:
How do I copy to the clipboard in JavaScript?
(27 answers)
Closed 8 years ago.
The workflow is simple:
You click inside a textarea.
The text is copied to the client's clipboard.
Display notice to the user.
How do you do it?

Copying to the clipboard is a tricky task to do in Javascript in terms of browser compatibility. The best way to do it is using a small flash. It will work on every browser. You can check it in this article.
Here's how to do it for Internet Explorer:
function copy (str)
{
//for IE ONLY!
window.clipboardData.setData('Text',str);
}

Related

How can I know that the Firefox Developer tools are open with Javascript? [duplicate]

This question already has answers here:
How to detect if browser console / inspector is *open*?
(3 answers)
How do you detect if firefox DevTools is open? [duplicate]
(1 answer)
Closed 3 years ago.
I need to find a certain indications to detect whether or not Firefox Developer tools are open for the site I placed in. It has to be done with vanilla JS in the client side scope.
I found many indications for Chrome browser, but couldn't find even one stable way for Firefox.
Thanks

Get clipboard text [duplicate]

This question already has answers here:
Get current clipboard content? [closed]
(4 answers)
Closed 5 years ago.
Is there a way in Angular2 to get text from the clipboard? I found a lot of information about copying to the clipboard, but nothing regarding the other way around.
you can use this, but this is in a javascript way, you may need to modify this in typescript with event binding on which you want to show.
window.clipboardData.getData('Text')
but it will work in some browsers. However, many browsers where it does work will prompt the user as to whether or not they wish the web page to have access to the clipboard.

Is there a way to trigger "find" in a browser through javascript? [duplicate]

This question already has answers here:
Use Browser Search (Ctrl+F) through a button in website?
(3 answers)
Closed 9 years ago.
Does javascript allow for to trigger a "find" action with a keyword on the current page?
No, there's no cross-browser way to do this. (I don't even know of one browser that exposes that functionality.)

is there a way to open the f12 with a script? [duplicate]

This question already has answers here:
How can I open the Google Chrome Console from JavaScript? [duplicate]
(3 answers)
Closed 8 years ago.
Well guys,
I am new with javascript, and i have a problem. Exist a script in Javascript that can do virtually what the f12 key does? Just open the console without pressing the f12 key.
With pure JavaScript, running in the brwoser itself, this is not possible.
If you want to do it with an extension, yes it can be done:
This is the documentation for Chrome: https://developer.chrome.com/extensions/devguide.html
This is the FireFox add-on guide: https://developer.mozilla.org/en-US/docs/Firefox_addons_developer_guide

Do not let end-user save password [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Disable browser ‘Save Password’ functionality
Is there a standard way to prevent the end-user's web browser from saving a password using HTML or maybe JavaScript?
Use the non-standard autocomplete="off". Your HTML won't validate with it, though.
Info at Mozilla Developer Center
Info at MSDN
In HTML5 you can use autocomplete="off" but that will only work on browsers that support it

Categories