execute javascript in trigger does not work in Sharepoint 2013
Jun 27, 2014
We have designed a certificate of completion using javascript to get the current date as outlined on this forum, but it is not working within our SharePoint environment where the content is hosted. It works properly locally(View after publish to web/lms as well as publish to CD), and in an LMS environment (reviewmyelearning.com), but when I publish for web and transfer the storyline output files to SharePoint 2013 (SSL connection), the date is not displayed (no error message). I had similar results trying to use other javascript functions (print does not open the dialog box, exit course does not close the window, no visible error messages generated) in storyline triggers within the sharepoint environment.
Any suggestions as to why these functions would not work in that environment only? Other storyline functionality appears to be working as expected. Is execution of functions in the user.js a capability that would need to be enabled in the sharepoint configuration?
8 Replies
I'm having the same problem. I know that you can't run JavaScript inline on a page in SharePoint 2013. If you want to run a JavaScript, you have to put the script in a separate text file and call it from there.
I suspect that those issues are related.
Is there a way for the Storyline project to call a function in a separate JavaScript file? That would probably be a workaround.
Hi, Martha and Mary - I just wanted to pop in and mention that although we don't provide support for JavaScript coding, it may be helpful to take a look at this document on JavaScript Best Practices. Hopefully, some of our JS experts in the community can chime in with suggestions!
As I suspected, it's SharePoint 2013. If I embed JavaScript in the trigger, SparePoint strips it out. However, if I put the code in a function in a separate .js file and call that function in the trigger, it works fine.
You need to add a reference to the .js file in the story.html file, too. Instructions for how to do that are here: https://community.articulate.com/discussions/articulate-storyline/articulate-storyline-external-links-easy-javascript-file-containing-the-links
Thanks Mary for that update and letting folks who lose Sharepoint know a workaround.
I am also having trouble using JavaScript with SharePoint 2016. Has anyone experienced this and found a solution?
Clicking a button in our course, executes the JavaScript function:
TravelersBBPDocument().
It is defined in a document on our SharePoint site as:
function TravelersBBPDocument()
{
window.open("https://collaborate.dealertire.com/People/DistributionCenterTrainingLibrary/travelers-bbp.pdf");
}
The code identifying the document that defines the function is inserted into the story.html file (approximately line 126).
<script language="JavaScript1.2"src="https://collaborate.dealertire.com/People/TrainingDevelopmentLibrary/elearning-course-links.js" type="text/javascript">
</script>
Ashley,
When I look at my request (above), it is greyed out. Can others see it?
Never mind, I resolved the issue. There was an extra bracket in the code - arghhhh!
No worries Glenda - sometimes a post may appear greyed out if it's been flagged as potential spam (either by our system or another user). We monitor those throughout the day for false positives though - so we'll always get you back up and running!
This discussion is closed. You can start a new discussion or contact Articulate Support.