Forum Discussion
Very strange JavaScript problem
Hi,
This is weird! I have a script called app.js and have included it in story.html as such (see Storyline-File.PNG)
When I open the Storyline in my browser, I view source and see the JavaScript lines, I am able to click on the link and it does indeed bring up the app.js file.
However, none of my functions are recognised, this has always worked before!
(see Browser.PNG)
Any ideas?
One thing to mention, I have not got a story_html5.html file (I think I opted not to use the new player - could that be it? - not sure how to turn it back on)
Thanks
- MathNotermans-9Community Member
Just publish again and change the player to the Modern Player. However this probably won't be the fix. Is your Javascript loaded whenever you want to call your functions ? I use a variable that i set to true whenever all external files are loaded...so i know when i can trigger any function.
- TyroneBishopCommunity Member
Thanks for the reply, I'll give it a go!
- Jürgen_Schoene_Community Member
perhaps "}" or ")" or another char is missing in the script - check your script
https://beautifytools.com/javascript-validator.php
update: i had the same behavior - i was missing the closing bracket in a function
- TyroneBishopCommunity Member
Thanks for the reply but I'm using the web developer tools in the browser and I have verified the script
- MathNotermans-9Community Member
Maybe missing a variable in Storyline ? Without seeing and testing your complete .story, its all guessing. You do know each trigger in Storyline has its own local scope ? So you do need to ensure variables are available on triggers.
- MathNotermans-9Community Member
I tried to get the same error...because i know i seen it too. And managed to do so. Its basically a missing library. You think your libraries ( app.js and/or xapiwrapper.js ) are available, but they probably arenot. Maybe pointing to a wrong directory or some like that.
I added a jQuery call...and jQuery ofcourse not more available by default... thus getting the error as i miss jQuery.
Maybe your libraries depend on JQuery, or maybe the script is pointing to a wrong directory...or scope... anyway...the libraries are not found.