Explore the community Forums Lectora Lectora Questions & Answers Javascript does not work from LMS in IE

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #314166 Score: 0
    Profile photo of cpliu
    cpliu
    Member
    beginner
    intermediate
    contributor
    curious george
    wise owl
    Group Member
    2 pts
    @cpliu

    I have Javascript to find the folder name of the course and place the title based on the course foldername. It works if I drag and drop to IE browser window. If I launch it from LMS (Pathlore), IE can’t pick up the name while Chrome picks up the name fine. Unfortunately, IE11 is the default browser in the company I work for so I have to make it work in IE launched from LMS.

    <script>
    var theURL = window.location.href.split(‘/’);
    console.log(theURL);
    var totalLength = theURL.length
    var theFolderLocNum = totalLength – 2
    var courseCode = (theURL[theFolderLocNum]);
    VarcourseFolderLt.set(courseCode)
    //document.write(courseCode);
    //document.write(VarcourseFolderLt);
    </script>

    Object Type: Other

    Any tips to get it work?

     

    Thanks,

     

     

    #314167 Score: 1
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    200 pts
    @Klaatu

    Try:

    <script>
    var theURL = window.location.href.split(“/”);
    var totalLength = theURL.length;
    var theFolderLocNum = totalLength – 2;
    var courseCode = (theURL[theFolderLocNum]);
    VarcourseFolderLt.set(courseCode);
    </script>

    Note that if you copy and paste you will have to delete the quotes and put new ones in (use quotation marks, not single quotes).

     

    This post has received 1 vote up.
    #314168 Score: 1
    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

    G’day cpliu,

    Try:
    var theURL = window.location.href.toString().split(‘/’);

    HTH

    Regards, Peter

    This post has received 1 vote up.
    #314169 Score: 1
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    200 pts
    @Klaatu

    Make sure you end each line with a semi-colon.

    This post has received 1 vote up.
    #314293 Score: 0
    Profile photo of cpliu
    cpliu
    Member
    beginner
    intermediate
    contributor
    curious george
    wise owl
    Group Member
    2 pts
    @cpliu

    Thank you all for correcting my Javascript. With correction, it still can’t show the right title when the course is loaded in IE11 while it works when loading the page on its own. It works fine with Chrome too (both http and LMS). Eventually I had it working with Lectora 16.

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

You must be logged in to reply to this topic.