A Simple Way to Send Link from iPhone to Computer

Setup a simple Flask server and handle link sent with Workflow from iOS. (Within the same network)

We have various ways to send link from phones to computers, e.g. Instant Messenger is a capable way. Let’s suppose that we have Slack both installed on the phone and the computer. Then just click the Slack button in share sheet of Safari. It totally works.

However, I never actually chat on Slack for iPhone. Should I install it only for get my links shared?

Let’s figure out a simple approach as an alternative, if you only do it within the same network.

Setup a server to handle requests

For simplicity, I tend to choose a lightweight framework — Flask.

Install Python3 and Flask with Homebrew:

$ brew install python3
$ pip install flask
$ touch send_my_link.py

Then, write a handler:

import os
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def handle_recv():
link = request.args.get('link', '')
os.system("open %s" % link)
return 'RECV'

Serve your app:

$ FLASK_APP=send_my_link.py flask run --host=0.0.0.0

Build a Workflow to send link

Create a new workflow, and choose I relative icon. To make it more specific, accepting URLs only and the type is ActionExtension.

create workflow

Drag three simple steps and replace with your own IP and port:

Pretty simple, right? If anyone has a more elegant way, feel free to ping me.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.