I have the following question: let's suppose I copy some text from first browser tab and then I want to paste this text in textbox located in second browser tab. Is it possible to detect in whicxh tab pasted text was copied? Thank you in aadvance
Simple answer: no, this is not possible.
The exception is when you have control over the pages in all tabs and watch for the pasting.
well,I am thinking that you could detect onKeyPress() "ctrl+c" for each element. it only works for key press though not "right-click+copy". next, how do you want to pass it to second browser? you will have to pass the value to server first then to second browser. perhaps with socket.io..
I don't think the second browser can simply paste it.. not with ctrl+v nor with rightclick+paste.. but the copied-value is there, perhaps you might have to provide your own button which will make use of this value
Related
I've got a script that deals with pasted text in a text area. I would like to write some tests for it. The first step would be to copy some text in the clipboard so after reading a lot about the topic I ended up with something like this:
Add a text Area to the DOM with the text you want to copy.
Add a button to the DOM that runs document.execCommant("copy") on click.
Remove the text area & the button from the DOM.
Please take into account before marking this question as a duplicate, that all the other solutions I've seen involve the user performing the click action. I am asking about how to do this strictly programmatically.
document.execCommant("copy") does not work if it's not triggered by any user action due to security reasons. In my case, the tests are clicking on the button, but document.execCommant("copy") simply won't work.
Is there any way of doing this without using any new libraries? (jQuery is fine).
I am interested in a solution that works on Chrome/Firefox.
Here you can see a fiddle with the step I mentioned above: https://jsfiddle.net/7b40ma0q/
I have a question that is a little outside my realm. I'm a newbie to jquery and javascript. I run a forum on ProBoards, and when the forum runs out of its allocation for attachments (pictures the users can post) I have to manually go through the attachment list and check every single checkbox one by one, then I am able to click a delete button to delete every attachment I've checked. Checking the thousands of boxes one by one takes forever. There is no implemented "check all", and there are thousands of checkboxes.
In the code, every single checkbox has the name ids[]:
<input type="checkbox" value="1494" name="ids[]"></input>
So I should be able to target them by the name "ids[]" I would think. The value is different for each one. The name is the same for all. But the question is... what code would I use and where would I put it in Firebug or Inspector? I'm sadly too much of a noob to be able to figure out what I would do.
I have Firebug for Firefox, and in that I have the add-on jQuerify, so I can force jQuery into the code if that helps create the simplest solution.
Basically I'm looking for a way to add some code to automatically check every single one of these boxes (or add a button that will allow me to do so if that is the only way), and I must be able to do it from Firebug or the Inspector in Firefox (or even in Chrome would be fine). I don't think I am able to modify the code (permanently) of this specific administrative page of my forum, so I need to be able to do it from the Inspector/Firebug. I'd like something I can just copy and paste into there to save myself 45 minutes to an hour of clicking thousands of checkboxes one by one.
Any solutions?
Use like this,
$("input:checkbox").attr('checked','checked');
You should be able to use the following in the console:
$('[name="ids[]"]').prop('checked',true)
Using Inspector Console F12 you can get all checkbox and check them
$('input:checkbox').prop('checked', 'checked');
has anyone ever seem an autocomplete solution in JS that works like Chrome's Console? (I think this is in version 17+)
I am trying to build something using jQuery, but I can't imagine how the autocomplete placeholder that stays below the active text follows the cursor.
All the autocomplete thing, the search, sort, etc... I've already done, I just need a way that the placeholder follows the cursor. Thanks.
Well, why not to use a text box and to call function on any key press/key down. Then the function will read the text that is currently enter and check your data structure for possible end of the word.
You can sort the possible answer and to write the first one for example with other color. If the user press space or enter to color the whore world with black, and if it is press tab to switch with other possible answer...
Do you mean this?I can write some code to show you want I mean if this is what you need?
I want to know if it is possible to select the text anywhere on a webpage and then copy it using jQuery or Javascript.In another language how to invoke CTRL+X,CTRL+C and CTRL+V on a selected text using jQuery or Javascript?.Can this be done?However the CUT command will be invoked on the text which is present in a textarea or textbox not on the hypertext of the webpage. Please let me know.
You could probably invoke the buttons, and copying text on a webpage is most certainly possible with access to the DOM, however it seems like what you are trying to do is access the clipboard, and the way to do that consistently is usually with flash.
The ZeroClipboard plugin is the one most commonly used, it's easy to integrate and gives you full access ro the clipboard.
For an example have a look at CSS3Please, I believe they are using the ZeroClipboard plugin.
Can this be done?
...
I don't want to use Flash
No, not if you need it to work in all major browsers.
I'm trying to do something with Chrome's new speech recognition abilities with HTML5.
Following this page: http://www.filosophy.org/2011/03/talking-to-the-web-the-basics-of-html5-speech-input/ I see that you can easily hide the input area. But I'd like to take this further and automatically click the mic button (using javascript is possible?) without waiting for the user to click it.
Since the mic button resides on a specific region in the page always (dictated by me), is there a way to automate a click on a particular region on the webpage? So that the form doesn't wait for the user to click the button to populate itself. I'm guessing this should be possible with JS?
Please let me know, thanks :)
No, this is impossible for the same reason that you can't populate the value of a file input.
If you can turn the mic on without the user explicitly agreeing to it, then you could spy on what was being said near that mic.
For security reasons, this will never be possible.