Forum Discussion
Passing Articulate's SCORM locale=xx-x parameter to an Embedded Navattic link which accepts lang=xx
Hi Kurby
In summary it looks like you want to:
- Retrieve the locale parameter from the SCORM content URL
- Parse the value and use the first two characters of the locale, for example en-us would become en
- Use the value of the parameter to append to a Navattic embed url https://someurl.com?lang=es
If you add the following script to your MASTER SLIDE, on timeline start, as well as define a Storyline text variable called lang. The following script assumes we are taking the locale param value from the Storyline contents URL. This may need adjusting, as the value may be in the parent document. I have added some console.log/console.warn to output if the values are found in the URL.
The script will then try and detect an iframe on each page. If it finds one, it will look for the text "navattic". If this exists, it will be processed adding the new parameter to the navattic URL. I've done rudimentary testing locally, but obviously can't do a full tests without access to your environment.
// set a default language
const defaultLang = 'en';
// check if language is set
if (getVar('lang') === '') {
// language not set, parse from the URL
const pageUrl = new URL(window.location.href);
const locale = pageUrl.searchParams.get('locale');
if (locale && locale.length >= 2) {
// first two chars of the locale param
console.log(`locale param found: ${locale}`);
setVar('lang', locale.substring(0, 2).toLowerCase());
} else {
// default language
console.warn(`locale param not found, defaulting to ${defaultLang}`);
setVar('lang', defaultLang);
}
}
// function to update Navattic embed URL, appending the language parameter
const iframe = document.querySelector('iframe');
if (iframe && iframe.src.includes('navattic')) {
const iframeUrl = new URL(iframe.src);
const lang = getVar('lang');
iframeUrl.searchParams.set('lang', lang);
iframe.src = iframeUrl.toString();
console.log(`updated iframe URL: ${iframe.src}`);
}
Thanks SamHill. Unfortunately I was more looking at a solution for Articulate 360 instead of Storyline. Apologies that I didn't made that clear from the start. Is it true that 360 (unlike storyline0 is unable to have scripts? As such I was trying to see if someone has an idea of doing it at the exported SCORM level
- SamHill2 months agoSuper Hero
Hi Kurby I'm not familiar with "Articulate 360" as an individual product. I thought that was the name of the desktop application for managing the individual software. I just saw you have Rise 360 tagged in the post. Sorry, I missed that. Can you confirm what you are authoring your content in. Is it Rise 360 or did you mean one of the Studio 360 products?
Related Content
- 5 months ago
- 9 months ago