Skip to main content



Flexible Share Feature

Adding a share button to a website can be more difficult than it should be. For one reason or another, this is one of those features that still requires a lot of feature detection. I recently implemented a share button and wanted to share my implementation. You can see a working example below, along with the JS, HTML, and CSS.URL Copied! Share The implementation is a bit on the verbose side and could definitely be improved in various ways. However, it uses only native APIs and should be easy to customize to fit your needs. It also uses newer APIs if they are available and falls back to older APIs when neccessary.JavaScriptThe JavaScript loops over a set of "share" objects so that more than one can be added to the page. In each case the logic is to use the navigator.share if available, or if not fall back to copying the url. If the navigator.clipboard is available, that is used, otherwise the execCommand method is used. Text is hidden and shown so that browsers with tigher secu…

Latest Posts

Exploring Open Source Content Management

True Interoperability and the As a Service Model

Season of the Sword Character Sheets

Introducing Season of the Sword

Photoshopping Old Art

Pen and Marker Drawings

Agile Story Estimation: Points are not Associative

Static Websites Can Be Progressive Single Page Applications

Podcasts are the new Reality Television

Battle of Shiloh