VAR(BrowserType) in Offline output

ahetherington9113
ahetherington9113 Community Member Posts: 132 ☆ Roadie ☆
Using Lectora Inspire 17.3.1

Does anyone know if the VAR(BrowserType) reserved variable can be used to detect a title published for offline use? The Lectora help files (please see image attached), indicate that this variable should be populated with LectoraViewer if a title is published for offline use.

When I published a test with this variable populating a text box, and published as offline output, the textbox is populated with Netscape.

What I want to do, is configure certain actions to take place automatically if the output is offline, and other actions if the output is html.

Any advice would be appreciated.

Regards

Amanda

Comments

  • mnotermans5114
    mnotermans5114 Community Member Posts: 916
    Not sure whether you can use that specific Var for it, you can detect it though. When the URI path is not http:// or https:// you can conclude its a local test...
  • ahetherington9113
    ahetherington9113 Community Member Posts: 132 ☆ Roadie ☆
    Thanks Math.

    What I'm trying to do, is have a conditional action that is based on whether the title is offline or html. I need to use the same title, and publish it for offline and for html, and have it behave differently depending on which output.

    I thought BrowserType should work, because the help file says that it should show LectoraViewer if published for offline use.

    Any advice would be welcome.

    Regards

    amanda

     
  • timk
    timk Community Member Posts: 1,205 ♦ Idol ♦
    The help has not been updated for a while. Lectora doesn't use the Lectora Viewer any more. It's been changed to use Awesomium as the browser to display content published to offline. The good thing about this is that you now can use Javascript in offline content as well and check the url of the course.

    Create a variable, e.g. "offline"

    Add two actions on title level:

    Action: Modify variable
    Target: offline
    Type: Set as empty

    Action: Run javascript
    Javascript:
    if (window.location.href.indexOf("file") > -1){
    Varoffline.set("yes");
    }else{
    Varoffline.set("no");
    }

    The URL of the page will contain "file" if it's opened offline. You can use the variable in conditions, e.g.

    Only if "offline" "equal to" "yes"
  • ahetherington9113
    ahetherington9113 Community Member Posts: 132 ☆ Roadie ☆
    Excellent, thanks @timk

    That's really helpful. I did all of that and got the var to change to 'yes', so I can now apply this to my tutorial.

    Thanks for your help Tim and Math :)

    Cheers

    Amanda