Skip to content

Instantly share code, notes, and snippets.

@snemarch
Created November 5, 2015 11:52
Show Gist options
  • Save snemarch/5ce633daccabad591ce9 to your computer and use it in GitHub Desktop.
Save snemarch/5ce633daccabad591ce9 to your computer and use it in GitHub Desktop.
GreaseMonkey redirect script for Berlingske mobile->desktop site
// ==UserScript==
// @name Berlingske mobile->desktop redirect
// @namespace kthx.dk
// @include http://m.b.dk/*
// @include https://m.b.dk/*
// @version 1
// @run-at document-start
// @grant none
// ==/UserScript==
var matcher = /(https?:\/\/)m.b.dk\/\?redirect=(.*)/;
var match = matcher.exec(window.location);
if(match != null) {
var uri = match[1] + decodeURIComponent(match[2]);
window.location = uri;
// use .replace() instead of assignment if you don't want the mobile version in browser history.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment