Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a paste function in chrome console?

Chrome provides a copy(myCopyObj) to copy an object. Do we have anything similar in terms of pasting an object or getting the contents from the clipboard?

like image 498
Vikramjit Roy Avatar asked Oct 17 '22 16:10

Vikramjit Roy


1 Answers

"Getting the contents from clipboard"

Execute the following on devtools side and within 3 seconds focus on the window (by clicking somewhere, or just hitting <tab>).

setTimeout(async()=>console.log(await window.navigator.clipboard.readText()), 3000)

This will just print the clipboard content. You can replace console.log with code that actually uses the clipboard content.

like image 151
Jannis Ioannou Avatar answered Nov 02 '22 06:11

Jannis Ioannou