Branching scenario Mar 15, 2017 By Mike Saunderson I'm building a Storyline 360 course and need to know if Storyline 360 can auto detect the browser (either Google Chrome or Internet Explorer) and follow a branch based on that information.
Dave Cox over 6 years ago03/15/17 at 11:39 am (UTC) Hi Mike, I doubt that Storyline 360 has any built in facilities to detect the user's browser, but it can be done if your willing to modify the published files. First you need some javascript like this to determine the browser type: function myBrowser() { var Browser = '';if((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1 ) { Browser = 'Opera'; } else if(navigator.userAgent.indexOf("Chrome") != -1 ) { Browser = 'Chrome'; } else if(navigator.userAgent.indexOf("Safari") != -1) { Browser = 'Safari'; } else if(navigator.userAgent.indexOf("Firefox") != -1 ) { Browser ='Firefox'; } else if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10 { Browser = 'IE'; } else { Browser = 'unknown'; }return Browser; } function getBrowser() {var player = GetPlayer();var Browser = myBrowser();player.SetVar("Browser", Browser);} You should place the above javascript into the story.html file, or into a javascript file that you create a link to in the story.html file. Then you need away to return that value to Storyline: Create a Stroyline text variable called Browser Create a trigger on the first slide to run your javascript and populate the Browser variable with the Browser name. In the javascript trigger, add this line: getBrowser(); Now that you have the browser name in a Storyline variable, you can create a trigger to do whatever you want based on the name of the user's browser.
1 Reply
Hi Mike,
I doubt that Storyline 360 has any built in facilities to detect the user's browser, but it can be done if your willing to modify the published files.
First you need some javascript like this to determine the browser type:
function myBrowser() {
var Browser = '';
if((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1 ) {
Browser = 'Opera'; }
else if(navigator.userAgent.indexOf("Chrome") != -1 ) {
Browser = 'Chrome'; }
else if(navigator.userAgent.indexOf("Safari") != -1) {
Browser = 'Safari'; }
else if(navigator.userAgent.indexOf("Firefox") != -1 ) {
Browser ='Firefox'; }
else if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10 {
Browser = 'IE'; }
else {
Browser = 'unknown'; }
return Browser; }
function getBrowser() {
var player = GetPlayer();
var Browser = myBrowser();
player.SetVar("Browser", Browser);
}
You should place the above javascript into the story.html file, or into a javascript file that you create a link to in the story.html file.
Then you need away to return that value to Storyline:
Now that you have the browser name in a Storyline variable, you can create a trigger to do whatever you want based on the name of the user's browser.
This discussion is closed. You can start a new discussion or contact Articulate Support.