Skip to content

Instantly share code, notes, and snippets.

@XP1
Created February 15, 2012 01:21
Show Gist options
  • Save XP1/1832301 to your computer and use it in GitHub Desktop.
Save XP1/1832301 to your computer and use it in GitHub Desktop.
Fix session history navigation: Fixes HTML5 session history navigation when the URL argument is specified but is `null` or `undefined`.
// ==UserScript==
// @name Fix session history navigation
// @version 1.01
// @description Fixes HTML5 session history navigation when the URL argument is specified but is `null` or `undefined`.
// @author XP1 (https://github.com/XP1/)
// @namespace https://gist.github.com/1832301/
// @include http*://launchpad.net/*
// @include http*://*.launchpad.net/*
// ==/UserScript==
/*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */
(function (history)
{
"use strict";
function fixState(realStateFunction)
{
return function stateFunction(data, title, url)
{
return (typeof url === "string" ? realStateFunction.call(this, data, title, url) : realStateFunction.call(this, data, title));
};
}
var realPushState = history.pushState;
history.pushState = fixState(realPushState);
var realReplaceState = history.replaceState;
history.replaceState = fixState(realReplaceState);
}(this.history));
@XP1
Copy link
Author

XP1 commented Feb 15, 2012

I posted this user JS in this thread:

launchpad.net bug search broken with Opera:
http://my.opera.com/community/forums/topic.dml?id=1303132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment