Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CP9 - External java library ref not working in On Enter action.

Engaged ,
Oct 23, 2017 Oct 23, 2017

CP 9.0.2.437

HTML5 Output only

Hello,

I want to use an external java library.

I have it working successfully by putting a reference to it in my index.html file.

<script  src="../../java_library/my_java_library.js"></script>

However, I would rather be able to reference the library from within the project.

I found the code below in the forum and have placed it in the 'On Enter' action of the first slide.

Unfortunately it did not work, even by using either relative or absolute addressing.

$(‘body’).append(‘<script src=”http://myservername/myfolder/mylibrary.js” async=”false”></script>’);

If anyone can suggest where I am going wrong I would appreciate it.

Thank you

Peter

Untitled.png

329
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Oct 24, 2017 Oct 24, 2017

Check out this thread. One of these will surely work.

javascript - Can't append <script> element - Stack Overflow

Translate
People's Champ ,
Oct 23, 2017 Oct 23, 2017

You can't use that example literally, it doesn't exist.

If I had a js file to link on my site it could be:

$(‘body’).append(‘<script src=”https://www.tlcmediadesign.com/scripts/cp.js" async=”false”></script>’);

You need to put the path to your file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 24, 2017 Oct 24, 2017

TLC,

Thank you for the feedback.

In my original post I removed the real server/folder/file path information as that is sensitive, and I replaced it with the dummy code.

So I am using a script exactly as you have suggested, but the it does not work.

Peter.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 24, 2017 Oct 24, 2017

Check out this thread. One of these will surely work.

javascript - Can't append <script> element - Stack Overflow

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 27, 2017 Oct 27, 2017
LATEST

TLC,

I have had a quick look at the thread and it appears to have some good tips, I will try them out.

Thank you for the suggestion.

Peter

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources