Identify browser and redirect learners

Hi there,

Is it possible to identify what internet browser a learner is using and, depending on what it is, take them to certain pages in a course?

My current issue is to identify if a learner is using IE8 when they launch the course. If they are using IE8 then it takes them to a warning page that instructs them to close and use a different version of the course. If they are using a browser other than IE8, it bypasses the warning page and continues on to the rest of the course.

The users will be launching the course from a LMS.

Can anyone provide any guidance on how this can be achieved? Thank you!

Discussion (5)

This blog post should be helpful: http://trivantis.com/blog/browser-detection-lectora/

Lectora already has the browser details and for this all that you need is:

is.ie8

You can run a JavaScript function on show to set a Lectora variable.

HTH

Regards, Peter

Thanks for the help everyone. We managed to use a workaround as the original code didn't allow us to navigate to different pages depending on the browser. Our alternative was to use a pop up that appears over all other content on the intro page.

We used an OnShowRunJS action attached to the page. This is the JS code we used:

var img = document.getElementById('image614517');

var elem = document.getElementById('text614515');

var div = document.createElement("div");

div.innerHTML = "

I suggest that you remove the part of the code that shows the specific text object and the specific image object. Use JS only to detect browser and show the warning image and text by a normal Lectora action:

So your code will be shorter:

var div = document.createElement(undefined!–[if lt IE 9]undefined

var isIeLessThan9 = (div.getElementsByTagName(undefined).length == 1);

if (isIeLessThan9) {

var Var_browserversion.set(';exit';);

} else {

var Var_browserversion.set(';progress';);

}

Then in Lectora, do two things:

1) create a custom Lectora variable called _browserversion

2) add all Lectora actions to show/hide your popup based on the _browserversion variable

or 2) create a Lectora action to Go To (Specific Page) IF _browserversion contains "exit" ELSE Go To (Some Other Page) - I guess this is what you wanted in the first place.

This way you will be able to easily re-use this code in a different course or adjust how your popup works in future, without touching the JS code.

On a separate note, a faster way to detect version is to rely on Lectora:

if (is.ie8) {

var Var_browserversion.set(';exit';);

} else {

var Var_browserversion.set(';progress';);

}

Thanks for the advice Sergey,

I wonder whether you have any experience with creating courseware that accommodates two layers of code? We have a client who advised that they implemented a decision tree at the start of the course that assesses the browser then serves up the content based on the discovery.

The two layers of code then took them to a particular chapter within the course that would be optimised for a particular browser, i.e.:

undefined

  • IE8 gets HTML code
  • IE11, Chrome, Safari etc gets HTML5

Does this make sense to you?

Discussions have been disabled for this post