Phone Link Redirector

bosmanx
2026-01-09T19:28:04Z

Redirects Bing searches from Phone Link notifications to actual web applications. Configure custom redirect rules via the Tampermonkey menu.

Phone Link Redirector

A Tampermonkey userscript that redirects Bing search results (triggered by Microsoft Phone Link notifications) to actual web applications instead of showing Bing search pages.

Version: 1.2.5 | Changelog

Problem

When you click on notifications in Microsoft's Phone Link app, it opens Bing search results for the app name instead of directly opening the app or website. This userscript intercepts those Bing searches and redirects them to the correct destinations.

Features

Automatic Redirects: Redirects Bing searches to configured web apps

Configurable Rules: Add, edit, and delete redirect rules via a simple UI

Default Rules Included: Comes with 6 default rules:

Whatsapp → https://web.whatsapp.com/

Bankieren → https://mijn.ing.nl/login/

Calendar → https://calendar.google.com/

Photos → https://photos.google.com/

Maps → https://maps.google.com/

Messenger → https://www.messenger.com/desktop

Case-Insensitive Matching: Works regardless of query capitalization

Storage Persistence: Rules are saved and persist across browser sessions

Installation

Prerequisites

1. Tampermonkey Extension: Install Tampermonkey for your browser:

Chrome/Edge

Firefox

Safari

Install the Userscript

Option 1: Install from GitHub (Recommended)

1. Go to GitHub repository

2. Click on phone-link-redirector.user.js

3. Click "Raw" button

4. Tampermonkey will detect the userscript and prompt you to install it

5. Click "Install" in the Tampermonkey dialog

Option 2: Manual Installation

1. Open Tampermonkey dashboard (click Tampermonkey icon → Dashboard)

2. Click "Create a new script"

3. Delete the default template code

4. Copy the entire contents of phone-link-redirector.user.js from the GitHub repository

5. Paste into the Tampermonkey editor

6. Click "File" → "Save" (or Ctrl+S)

7. The script is now active!

Usage

Automatic Redirects

Once installed, the script automatically redirects Bing searches matching your configured rules. For example:

Navigate to https://www.bing.com/search?q=Whatsapp → Redirects to WhatsApp Web

Navigate to https://www.bing.com/search?q=Calendar → Redirects to Google Calendar

Configure Rules

How to Access Configuration:

1. Navigate to a Bing search page (required for the menu command to appear):

Go to: https://www.bing.com/search?q=test (or any Bing search URL)

2. Click the Tampermonkey icon in your browser toolbar

3. Look for "Configure Redirect Rules" in the dropdown menu

It should appear directly in the menu (not nested)

If you don't see it, make sure you're on a Bing search page (bing.com/search*)

4. Click "Configure Redirect Rules" to open the configuration window

Note: The menu command only appears when you're on a page that matches the script's pattern (https://www.bing.com/search*). This is a Tampermonkey limitation - menu commands are only available on matching pages.

In the Configuration Window:

View all current rules

Add new rules (click "Add Rule")

Edit existing rules (modify the query or redirect URL)

Delete rules (click "Delete" next to a rule)

Reset to defaults (click "Reset to Defaults")

Click "Save" when done

Close the configuration window

Note: If the menu command doesn't appear, make sure:

The script is enabled (green checkmark in Tampermonkey menu)

You're on a Bing search page (https://www.bing.com/search*)

Popups are allowed for the site

Adding Custom Rules

To add a custom rule:

1. Open the configuration UI

2. Click "Add Rule"

3. Enter the search query (e.g., "Gmail")

4. Enter the redirect URL (e.g., "https://mail.google.com")

5. Click "Save"

The rule will be active immediately.

Development

Project Structure

phone-link-redirector/
├── phone-link-redirector.user.js    # Main userscript
├── phone-link-redirector.test.js    # Unit tests
├── package.json                     # Node.js dependencies
├── CHANGELOG.md                     # Version history
├── README.md                        # This file
└── .gitignore                       # Git ignore file

Running Tests

1. Install dependencies:

pnpm install

or

npm install

2. Run tests:

pnpm test

or

npm test

Test Coverage

The unit tests cover:

URL parsing (including URL encoding)

Rule matching (case-insensitive)

Redirect logic (loop prevention)

Storage operations (load/save)

Edge cases (invalid inputs, missing parameters)

How It Works

1. Interception: The script runs at document-start to intercept Bing URLs before the page loads

2. Query Extraction: Extracts the q parameter from the Bing search URL

3. Rule Matching: Matches the query against configured rules (case-insensitive)

4. Redirect: If a match is found, redirects to the target URL using window.location.replace()

5. Storage: Rules are stored using Tampermonkey's GM_getValue/GM_setValue APIs

Technical Details

Userscript Metadata

Match Pattern: https://www.bing.com/search*

Run At: document-start (critical for early interception)

Grants: GM_getValue, GM_setValue, GM_registerMenuCommand

Auto-Update: Enabled via @updateURL and @downloadURL pointing to GitHub raw file

Tampermonkey checks for updates every 24 hours (configurable in Tampermonkey settings)

Users will be prompted to update when a new version is detected

Rule Format

Rules are stored as an array of objects:

[
  { query: 'Whatsapp', redirect: 'https://web.whatsapp.com/' },
  { query: 'Gmail', redirect: 'https://mail.google.com' }
]

Edge Cases Handled

URL encoding/decoding

Missing query parameters

Empty queries

Redirect loops (prevents redirecting if already on target domain)

Invalid URLs

Storage errors (falls back to default rules)

Troubleshooting

Script Not Working

1. Check if script is enabled: Tampermonkey icon → Check "Phone Link Redirector" is enabled

2. Check browser console: Press F12 → Console tab → Look for errors

3. Verify URL pattern: Make sure you're on https://www.bing.com/search*

4. Check rules: Open configuration UI → Verify rules are saved correctly

Redirect Not Happening

1. Check query match: The query must match exactly (case-insensitive)

2. Check redirect URL: Make sure the redirect URL is valid

3. Check console: Look for "Phone Link Redirector: Redirecting..." message

4. Verify script is running: Check Tampermonkey dashboard → Script should show as active

Configuration UI Not Opening

1. Check Tampermonkey permissions: Make sure popups aren't blocked

2. Check browser console: Look for JavaScript errors

3. Try refreshing: Close and reopen Tampermonkey menu

Contributing

Feel free to submit issues or pull requests if you have improvements or bug fixes!

GitHub Repository: https://github.com/bosmanx/phone-link-redirector

Report Issues: GitHub Issues

License

MIT License - feel free to use and modify as needed.

Acknowledgments

Based on the Phone-Link-Redirector Chrome extension by jhonniedj, converted to a Tampermonkey userscript for cross-browser compatibility.