Javascript

Copy-Cut-Paste In Javascript (Simple Clipboard Examples)

Welcome to a quick tutorial on how to copy, cut, and paste with Javascript. The Stone Age of the Internet is long over, and yes, we can use Javascript to access the user’s clipboard. Use navigator.clipboard.writeText(“TEXT”) to copy a block to text into the clipboard. var txt = document.getElementById(“TEXT-FIELD”).value; navigator.clipboard.writeText(txt); Use navigator.clipboard.readText() to access the

Copy-Cut-Paste In Javascript (Simple Clipboard Examples) Read More »

Get URL Parts In Javascript (Host, Path, File, Query, ETC…)

Welcome to a tutorial on how to get the full URL and parts in Javascript. Need to extract certain parts of the URL? Here are some of the common ones: Use location.href to get the full URL. For example – http://site.com/path/file.html?key=value Use location.origin to get the protocol and hostname. For example – http://site.com/ Use location.pathname

Get URL Parts In Javascript (Host, Path, File, Query, ETC…) Read More »

Checking Javascript Version (Why It Makes No Sense)

So you are looking for ways to check the Javascript version, add some compatibility checks to your project? “Javascript version” can refer to any of the following in the modern-day: ECMA International now handles the recommended standards for the development of Javascript – ECMAScript 1st edition (ES1), ECMAScript 2nd edition (ES2), etc… Every company has

Checking Javascript Version (Why It Makes No Sense) Read More »