Skip to content

Commit

Permalink
Merge pull request #363 from Netcentric/362-liveux-origin-header
Browse files Browse the repository at this point in the history
#362: LiveUX Origin header
  • Loading branch information
nc-andreashaller authored Jul 25, 2023
2 parents f4565f8 + f073662 commit 66037f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/delayed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sampleRUM('cwv');
// add more delayed functionality here
const main = document.querySelector('main');

function injectScript(src) {
function injectScript(src, crossOrigin = '') {
window.scriptsLoaded = window.scriptsLoaded || [];

if (window.scriptsLoaded.indexOf(src)) {
Expand All @@ -16,6 +16,9 @@ function injectScript(src) {

script.src = src;
script.setAttribute('async', 'true');
if (['anonymous', 'use-credentials'].includes(crossOrigin)) {
script.crossOrigin = crossOrigin;
}
head.append(script);
window.scriptsLoaded.push(src);
}
Expand Down Expand Up @@ -46,7 +49,7 @@ function loadLaunch() {

function loadLiveUXRUM() {
const src = 'https://liveux.cnwebperformance.biz/collector/collector.min.js?id=webperf-netcentric';
injectScript(src);
injectScript(src, 'anonymous');
}

function loadSidekickExtension() {
Expand Down

0 comments on commit 66037f9

Please sign in to comment.