From e76a64dda173db84e34eefc6baaa2981fe4a6801 Mon Sep 17 00:00:00 2001 From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Mon, 17 Feb 2020 17:11:59 -0600 Subject: Inject SVG sprite via ajax (#10320) * AJAX SVG * Fix PWA * Remove unused PWA assets Signed-off-by: jolheiser Co-Authored-by: silverwind --- web_src/js/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'web_src') diff --git a/web_src/js/index.js b/web_src/js/index.js index 68fb4fddbc..2f2baddcfb 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -3581,3 +3581,12 @@ window.onOAuthLoginClick = function () { oauthNav.show(); }, 5000); }; + +// Pull SVGs via AJAX to workaround CORS issues with tags +// https://css-tricks.com/ajaxing-svg-sprite/ +$.get(`${window.config.StaticUrlPrefix}/img/svg/icons.svg`, (data) => { + const div = document.createElement('div'); + div.style.display = 'none'; + div.innerHTML = new XMLSerializer().serializeToString(data.documentElement); + document.body.insertBefore(div, document.body.childNodes[0]); +}); -- cgit v1.2.3