Audio based on JS Browser Detection?
June 27, 2016 12:00 AM
Hi all,
I need to add a function to a Lectora project that is exactly the functionality described in this article:
http://trivantis.com/blog/browser-detection-lectora/
...But when I implement the Run JS trigger, it seems to break my module. When published and run, I see the screen in the screenshot I am attaching here.
I have tried running the module both locally and off of a network. Here is the live testing link:

Discussion (6)
There are two lines of code in Sergeys code that contain ". If you've copied the code directly from the blog to Lectora you could try to replace the " with real quotes [Shift] + 2.
Tim
Hi all,
I think I have found the cause of this issue -- when I added the Javascript to the trigger, I copied and pasted it from the blog page, which I guess must have retained some formatting or something of that sort?
In any case, I downloaded the example source file, and copied the actual trigger from there to paste into my project, and now it works perfectly!
Thanks!
Yep, blog formatting screws up the quotation marks and replaces JS quotes with fancy asymmetrical quotes :/
@John
Since this is more-or-less "code" if you wrap it in a code block when you post, WP will ignore trying to format all the single and double quotes it finds in the block. Here's an example:
undefinedfont-size: 11.0pt; font-family: ';Calibri';,sans-serif; color: #1f497d;undefinedcolor: #0563c1; text-decoration: none; text-underline: none;undefined
When you edit, make sure you are in Text mode, not Visual. Select your code and then hit the 'code' button in the editor, and it will format the code block for you.
Discussions have been disabled for this post