Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Svg Fix for Firefox when base-tag is set
jQuery.svgBaseFix = function() {
if ($("base").length) {
var Url = window.location.href;
// Get rid of existing hashtags
var hash = window.location.hash;
var CleanUrl = Url.replace(hash, "");
var origin = window.location.origin.length + 1;
var trimmedUrl = CleanUrl.substring(CleanUrl.length, origin);
$("svg:not(.no-convert) use").each(function(){
var href = $(this).attr("xlink:href");
var str = href.split("?");
str = str[str.length - 1];
$(this).attr("xlink:href", trimmedUrl + str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment