Create a Tweet This link without JavaScript

What do I want?

A pure HTML solution, no JavaScript required to allow my readers to tweet a post. In my case I want to do it with WordPress but today's solution can be used anywhere 😉


Creating a regular link pointing to:

More on Twitter Web Intents

Use WordPress functions for title and URL

Encode for URL and make sure characters look good

Your title might have characters that won't work well with just urlencode() function. Let's mix it:

Final output

The whole thing, including an inline SVG for the Twitter icon:

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

Leave a Reply

Add <code> Some Code </code> by using this tags.