Last week at Apple’s Worldwide Developer Conference several continuity features were announced for iOS 8 and OS X Yosemite. One of them is called “Handoff.” This feature lets you hand-off an activity from one device to another. For example, if you’re looking at Safari on your iPhone but want to move over to your iPad or Mac you can resume browsing on the other device right where you left off.
I was excited by the possibilities but when I got into the details I found it is mostly targeted at Handoffs between:
- a native app to a website
- a website to a native app
A website to website Handoff is possible but limited.
State Transfer and eCommerce
The problem is during a Handoff, Safari just passes the URL over to the receiving device. "State" such as cookies, is not transferred. If you’re shopping at your favourite online store, add a few items to your cart and switch to another device, it’s going to load the online store, but not the contents of your cart.
Transferring Cart Contents in Spree
In order to transfer state we need to take advantage of the URL. I’ve been working on a proof of concept that does this in Spree Commerce. Once you’ve added something to your cart, we’ll append a parameter to all URLs which contains the order number for your current order.
The receiving device knows this order number does not belong to this new cart, which triggers the contents of that order to be transferred to the receiving cart.
Proof of Concept
Source code is available here https://gist.github.com/djones/80394768b4e2cd0505ab
The receiving device may already have some items in its cart, so how do you handle conflicts? Perhaps prompting the user if they want to use the new cart instead is a solution.
Another issue is the need for an extra parameter on all URLs. This is not desirable so perhaps this would only happen if a supported browser and operating system was detected.
I hope Apple will add more advanced support for Handoff in Safari in the future. One might first think bringing cookies over would be a sound thing to do, but it creates complexities when the receiving device already has those cookies. Either way iOS 8 and OS X Yosemite greatly improve the user experience between multiple devices and I look forward to seeing where it goes next.
Join The Conversation
More On The Blog
Are Spree sites meeting Google’s page speed standards?
A study of 680 sites built on the Spree OS platform reveals nearly all are mobile friendly, but only a handful achieved a mobile speed score high enough to be considered by Google as performing well.
Barry Harrison — Sep 12, 2016
Machine Learning and eCommerce Talk at SolidusConf
I recently spoke at SolidusConf about Machine Learning and eCommerce
David Jones — Jun 14, 2016
Top 7 Product Recommendation Options
Top 7 Product Recommendation Options Ranked by Revenue Generation
Barry Harrison — May 31, 2016
Get every post in your inbox (see sample)