Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Demonstrates copying text to the system clipboard using NW.js.
// package.json
{
"name": "clipboard-app",
"main": "index.html",
"window": { "title": "Clipboard App", "width": 400, "height": 300 }
}
// index.html
<!DOCTYPE html>
<html>
<body>
<h1>Clipboard Example</h1>
<input id='textInput' placeholder='Type text here'/>
<button id='copyBtn'>Copy</button>
<script>
const clipboard = require('nw.gui').Clipboard.get();
document.getElementById('copyBtn').onclick = () => {
clipboard.set(document.getElementById('textInput').value, 'text');
alert('Copied to clipboard!');
};
</script>
</body>
</html>NW.js (previously known as Node-Webkit) is an open-source framework for building desktop applications using web technologies (HTML, CSS, JavaScript) with full access to Node.js APIs.
Origin & Creator
Developed by Intel’s Open Source Technology Center in 2011 (originally as Node-Webkit) to enable web developers to build desktop applications easily.
Industrial Note
NW.js is popular for desktop apps that need a web-like interface, rapid prototyping, or access to Node.js modules in a desktop environment.