Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

See this example of the channel "jp-ja" (i.e. Japan) and the language English (en_GB) selected:

Website restrictions

Your website framework doesn't allow script tags that load an external source

Solution: Create script tag via JavaScript

Expand
titleIf your framework allows inline JavaScript...

If the framework allows you to write inline javascript, try loading the advisor with the following script in your HTML code

Code Block
languagexml
titleinline JS
<script>
    const scriptUrl = '//stage.excentos.com/demo/DE/app_Bike-Advisor/en_US/loadadvisor?theme=default';

    const tag = document.createElement("script"),
        body = document.getElementsByTagName('body')[0];
    tag.type = 'text/javascript';
    tag.src = scriptUrl;
    body.appendChild(tag);
</script>
<div id="xc_application">
    <div id="xc_application_pane"></div>
    <div id="xc_loader"></div>
</div>


Solution: Load advisor via local JavaScript file

Expand
titleIf your Framework allows local JavaScript files...

If your Framework doesn't allow inline JavaScript but it does allow loading local javascript files, upload the following script to your CMS

Code Block
languagejs
titlexcLoader
/**
 * =============================================================================
 *  Copyright (c) 2022 excentos Software GmbH, Potsdam, Germany.
 *  All rights reserved. Do not redistribute. Strictly confidential.
 * =============================================================================
 */
const xcLoader = (win, doc) => {
    const env = 'stage';
    // const env = 'service' // use for production environment
    const acc = 'demo'; // account/company name
    const app = 'app_Bike-Advisor'; // application name
    const system = 'DE';

    const params = {
        xcTheme: 'default',
        xcLocale: 'en_US',
        // $channelid: '',
    }
    //*********************** lib ***********************//

    //inject service.jsinit
    var session = win.location.href.match(/xcSessId=[^&;? ]+/) || doc.cookie.match(/xcSessId=[^&;? ]+/);
    var jsessionid = (session && session.length > 0) ? ';jsessionid=' + encodeURIComponent(session[0].split('=')[1]) : '';


    const baseUrl = `https://${env}.excentos.com`;

    // let scriptSrc = `https://${env}.excentos.com/${acc}/${system}/restservice_v3_0/${app}/service.jsinit${jsessionid}?${paramsStr}`;
    const scriptUrl = new URL(`${acc}/${system}/restservice_v3_0/${app}/service.jsinit${jsessionid}`,baseUrl);
    scriptUrl.search = new URLSearchParams(params);

    var tag = document.createElement("script"),
        body = document.getElementsByTagName('body')[0];
    tag.type = 'text/javascript';
    tag.src = scriptUrl;
    tag.id = "xcJsInit";
    body.appendChild(tag);
};

xcLoader(window, document);

And load this script in your page, i.e. like this:

Code Block
languagexml
<script id="xc_loadadvisor" src="xcLoader.js"></script>

<div id="xc_application">
    <div id="xc_application_pane"></div>
    <div id="xc_loader"></div>
</div>

Or by using an appropriate component type your framework offers.


Please contact our support if you have any questions.