diff --git a/client/src/components/layouts/tc-integration.tsx b/client/src/components/layouts/tc-integration.tsx index d7211792668391..136cd7f7acd1a3 100755 --- a/client/src/components/layouts/tc-integration.tsx +++ b/client/src/components/layouts/tc-integration.tsx @@ -146,8 +146,10 @@ class TcIntegrationLayout extends Component { // set the pathname for the 2 flavors of lesson URL const platformPathPrefix = 'learn/freecodecamp'; const learnPrefix = '/learn/'; + let updateHost = false; if (url.host === `learn.${fccHost}`) { url.pathname = `${platformPathPrefix}${url.pathname}`; + updateHost = true; } else if ( url.host === `www.${fccHost}` && url.pathname.startsWith(learnPrefix) @@ -156,10 +158,13 @@ class TcIntegrationLayout extends Component { learnPrefix, `/${platformPathPrefix}/` ); + updateHost = true; } // set the host to the iframe's parent domain - url.host = new URL(document.referrer).host; + if (updateHost) { + url.host = new URL(document.referrer).host; + } } // now open the url in a new tab