The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for September 27th, 2023

Javascript – Copy string to clipboard as text/html – Stack Overflow

Posted by jpluimers on 2023/09/27

For my link archive is the below answer that should help me a lot with unfinished bits from Some JavaScript bookmarklets for WordPress published pages centered around navigation and IDs.

Goal of that post was to have some grounding and eventually find a means to build an HTML page in a new tab using a bookmarklet that I then later could post to my blog.

Assembling to HTML and putting it on the clipboard might be a lot easier and better fitting in my workflow.

So, via [Wayback/Archivejavascript copy html to clipboard – Google Search, for my link archive: [Wayback/Archive] Javascript – Copy string to clipboard as text/html – Stack Overflow (thanks [Wayback/Archive] Loilo for answering and [Wayback/Archive] kofifus for asking):

Below is a function that will do exactly that. I tested it with your required browsers, it works in all of them. However, IE 11 will ask for confirmation on that action.

Explanation how this works can be found below, you may interactively test the function out in this jsFiddle.

Read the rest of this entry »

Posted in Chrome, Development, Firefox, HTML, HTML5, Internet Explorer, JavaScript/ECMAScript, JSFiddle, Power User, Scripting, Software Development, Web Browsers, Web Development | Leave a Comment »