Adding absoluteUrl handling to polyfills
This commit is contained in:
parent
d926ba3e06
commit
42d7ed3134
@ -1,10 +1,11 @@
|
|||||||
import { $ } from 'meteor/jquery';
|
import { $ } from 'meteor/jquery';
|
||||||
|
import { absoluteUrl } from './lib/absoluteUrl';
|
||||||
|
|
||||||
/* jshint -W060 */
|
/* jshint -W060 */
|
||||||
// Check if browser is IE and add the polyfill scripts
|
// Check if browser is IE and add the polyfill scripts
|
||||||
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
|
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
|
||||||
const writeScript = fileName => {
|
const writeScript = fileName => {
|
||||||
const src = `/packages/ohif_polyfill/public/js/${fileName}`;
|
const src = absoluteUrl(`/packages/ohif_polyfill/public/js/${fileName}`);
|
||||||
document.write(`<script src="${src}"><\/script>`);
|
document.write(`<script src="${src}"><\/script>`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
10
Packages/ohif-polyfill/client/lib/absoluteUrl.js
Normal file
10
Packages/ohif-polyfill/client/lib/absoluteUrl.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
|
||||||
|
export const absoluteUrl = function(path) {
|
||||||
|
if (path) {
|
||||||
|
// Remove the leading "/"
|
||||||
|
path = path.replace(/^\//, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Meteor.absoluteUrl(path);
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user