Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Patch for bug with jquery-ui-tabs api when <head> has a <base href> tag.
//this is to patch a bug with the jquery.ui.tabs API
// it has to do with the <base href> tag in <head> and jquery.ui.tabs
// being smart about figuring out weather to AJAX a tab or not
;(function() {
var tabsInitialised = false;
var _tabs = $.fn.tabs;
var updateBaseHrefs = function() {
var base = location.href.replace(/#.*$/, '');
$('[data-jquery-ui-local]=true').each(function () {
var href = $(this).attr('href');
$(this).attr('href', base + href);
tabsInitialised = true;
$.fn.tabs = function() {
if (!tabsInitialised) updateBaseHrefs();
return _tabs.apply(this, arguments);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment