Tags: share

32

sparkline

Tuesday, October 22nd, 2019

203221 – Web Share API: should prefer URL to text when both available

That unusual behaviour I wrote about with the Web Share API in Safari on iOS is now officially a bug—thanks, Tess!

Wednesday, October 16th, 2019

The Web Share API in Safari on iOS

I implemented the Web Share API over on The Session back when it was first available in Chrome in Android. It’s a nifty and quite straightforward API that allows websites to make use of the “sharing drawer” that mobile operating systems provide from within a web browser.

I already had sharing buttons that popped open links to Twitter, Facebook, and email. You can see these sharing buttons on individual pages for tunes, recordings, sessions, and so on.

I was already intercepting clicks on those buttons. I didn’t have to add too much to also check for support for the Web Share API and trigger that instead:

if (navigator.share) {
  navigator.share(
    {
      title: document.querySelector('title').textContent,
      text: document.querySelector('meta[name="description"]').getAttribute('content'),
      url: document.querySelector('link[rel="canonical"]').getAttribute('href')
    }
  );
}

That worked a treat. As you can see, there are three fields you can pass to the share() method: title, text, and url. You don’t have to provide all three.

Earlier this year, Safari on iOS shipped support for the Web Share API. I didn’t need to do anything. ‘Cause that’s how standards work. You can make use of APIs before every browser supports them, and then your website gets better and better as more and more browsers add support.

But I recently discovered something interesting about the iOS implementation.

When the share() method is triggered, iOS provides multiple ways of sharing: Messages, Airdrop, email, and so on. But the simplest option is the one labelled “copy”, which copies to the clipboard.

Here’s the thing: if you’ve provided a text parameter to the share() method then that’s what’s going to get copied to the clipboard—not the URL.

That’s a shame. Personally, I think the url field should take precedence. But I don’t think this is a bug, per se. There’s nothing in the spec to say how operating systems should handle the data sent via the Web Share API. Still, I think it’s a bit counterintuitive. If I’m looking at a web page, and I opt to share it, then surely the URL is the most important piece of data?

I’m not even sure where to direct this feedback. I guess it’s under the purview of the Safari team, but it also touches on OS-level interactions. Either way, I hope that somebody at Apple will consider changing the current behaviour for copying Web Share data to the clipboard.

In the meantime, I’ve decided to update my code to remove the text parameter:

if (navigator.share) {
  navigator.share(
    {
      title: document.querySelector('title').textContent,
      url: document.querySelector('link[rel="canonical"]').getAttribute('href')
    }
  );
}

If the behaviour of Safari on iOS changes, I’ll reinstate the missing field.

By the way, if you’re making progressive web apps that have display: standalone in the web app manifest, please consider using the Web Share API. When you remove the browser chrome, you’re removing the ability for users to easily share URLs. The Web Share API gives you a way to reinstate that functionality.

Thursday, January 3rd, 2019

Wednesday, January 3rd, 2018

A Browser You’ve Never Heard of Is Dethroning Google in Asia - WSJ

I’m always happy to see a thriving market of competition amongst browsers—we had a browser monopoly once before and it was a bad situation.

(That said, UC Browser has its own issues.)

Tuesday, March 21st, 2017

The web share API | Phil Nash

I really need to have a play with this API. I think it could potentially be a useful indie web building block …if the web share target API also gets implemented.

Monday, October 24th, 2016

Introducing the Web Share API  |  Web  |  Google Developers

This is an interesting API that just landed in the newest version of Chrome behind a token—it gives you programmatic access to the OS’s share functionality via a (secure) website.

Paul finishes this rundown with the interesting bit:

Future work will also level the playing field for web apps, by allowing them to register to be a “share receiver”, enabling web-to-app sharing, app-to-web sharing and web-to-web sharing.

Maybe I’ll get to see a native “huffduff this” option in my lifetime.

Sunday, December 22nd, 2013

Frank Chimero × Blog × Homesteading 2014

I’m with Frank. He’s going Indie Web for 2014:

I’m returning to a personal site, which flips everything on its head. Rather than teasing things apart into silos, I can fuse different kinds of content together.

Homesteading instead of sharecropping:

So, I’m doubling down on my personal site in 2014.

Friday, July 12th, 2013

‘Kitten kitten kitten kittens’, Medium & TED(x) and RSSing since 2003.

Dan’s blog is rapidly turning into one of my favourite destinations on the web.

I hope he comes to an Indie Web Camp.

Wednesday, July 10th, 2013

The Problem With Medium

A good article on Medium on Medium.

Monday, July 1st, 2013

Enough with the JavaScript already!

A great set of slides from Nicholas, all about the disturbing trend in “modern” web apps to depend entirely on JavaScript as a single point of failure.

Thursday, June 20th, 2013

‘Kitten kitten kitten kittens’ — I.M.H.O. — Medium

This is what Medium is for.

If you want to read some of Dan Catt’s lesser thoughts, he has his own blog.

Sunday, May 19th, 2013

Tuesday, March 19th, 2013

Ideas of March — All in the head

A wonderful rallying cry from Drew.

The problem:

Ever since the halcyon days of Web 2.0, we’ve been netting our butterflies and pinning them to someone else’s board.

The solution:

Hope that what you’ve created never has to die. Make sure that if something has to die, it’s you that makes that decision. Own your own data, friends, and keep it safe.

Tuesday, January 22nd, 2013

Owning your own words – is it important?

A fascinating discussion on sharecropping vs. homesteading. Josh Miller from Branch freely admits that he’s only ever known a web where your content is held by somone else. Gina Trapani’s response is spot-on:

For me, publishing on a platform I have some ownership and control over is a matter of future-proofing my work. If I’m going to spend time making something I really care about on the web—even if it’s a tweet, brevity doesn’t mean it’s not meaningful—I don’t want to do it somewhere that will make it inaccessible after a certain amount of time, or somewhere that might go away, get acquired, or change unrecognizably.

When you get old and your memory is long and you lose parents and start having kids, you value your own and others’ personal archive much more.

Sunday, August 19th, 2012

Your words are wasted - Scott Hanselman

Amen, Scott, A-MEN:

You are not blogging enough. You are pouring your words into increasingly closed and often walled gardens. You are giving control - and sometimes ownership - of your content to social media companies that will SURELY fail.

Wednesday, April 11th, 2012

The Future Friendly Campus // Speaker Deck

It’s great to see the Future Friendly call-to-arms being expanded on. Here it’s university sites that are being looked at through a future-friendly lens.

Friday, March 16th, 2012

What Goes Up, Doesn’t Have To Come Down

A thoughtful—and beautifully illustrated—piece by Geri on memory and digital preservation, prompted by the shut-down of Gowalla.

Thursday, January 5th, 2012

Dark data, and how frustrating it is that we can’t see the forest from the trees – Helloform

Fred touches on the same issues that Frank highlighted in his dConstruct talk last year: what do we do with all of this wealth of material we’ve been collecting/ffffinding/scrobbling/liking/favouriting/plus-one-ing.

Monday, October 3rd, 2011

Crap! It doesn’t look quite right, or, how I learned to stop worryi…

Looks like Lyza’s presentation at Over The Air at Bletchley Park was really excellent.

Sunday, September 25th, 2011

It’s the end of the web as we know it « Adrian Short

A truly excellent article outlining the difference between share-cropping and self-hosting. It may seem that the convenience of using a third-party service outweighs the hassle of owning your own URLs but this puts everything into perspective.