Explore the community Forums Lectora Lectora Questions & Answers Identify browser and redirect learners

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #321504 Score: 0
    Profile photo of amak
    amak
    Member
    beginner
    intermediate
    friend finder
    curious george
    wise owl
    contributor
    2 pts
    @amak

    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!

    #321522 Score: 1
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    335 pts
    @ssneg

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

    This post has received 1 vote up.
    #321590 Score: 0
    Profile photo of Peter Jackson
    Peter Jackson
    Member
    beginner
    intermediate
    advanced
    friend finder
    contributor
    junior moderator
    wise owl
    group mod
    entry
    winner
    17 pts
    @pjackson2462

    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

    #321699 Score: 0
    Profile photo of amak
    amak
    Member
    beginner
    intermediate
    friend finder
    curious george
    wise owl
    contributor
    2 pts
    @amak

    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 = “<!–[if lt IE 9]><i></i><![endif]–>”;
    var isIeLessThan9 = (div.getElementsByTagName(“i”).length == 1);
    if (isIeLessThan9) {
    var _browserversion = ‘exit’;
    img.style.visibility = ‘visible’;
    elem.style.visibility = ‘visible’;
    }

    else {
    var _browserversion = ‘progress’;
    }

     

    The image and element sections would need to be changed depending on what you want shown on the page. Also, the image and text were set to initially hidden. Can anyone see any improvements we could have made or alternatives? Keen to hear what everyone thinks.

     

    Thanks,

    Andrew

    #321733 Score: 1
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    335 pts
    @ssneg

    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("div");
    div.innerHTML = "<!–[if lt IE 9]><i></i><![endif]–>";
    var isIeLessThan9 = (div.getElementsByTagName("i").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');
    }
    This post has received 1 vote up.
    #326015 Score: 0
    Profile photo of amak
    amak
    Member
    beginner
    intermediate
    friend finder
    curious george
    wise owl
    contributor
    2 pts
    @amak

    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.:

     

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

    Does this make sense to you?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.