Sc_include_library and .js

Hi,

I am trying to use a downloaded js library in SC (Stl Viewer Javascript Plugin- Docs). I have already created and gave the correct permissions for the library.

I try to include the library with the following code:

sc_include_library("prj", "STL/lib", "CanvasRenderer.js",true,true);

But the result is not correct… as it displays the following:

image

I don’t understand what happens and how to solve it. I tried downloading a php library (qrcode) and it works great… what am I missing?

Thanks in advance.

Hi, since the library you want to use is a javascript library, you have to use a different way to include it.
In the scriptinit event, use this code:
?>
<script type=“text/javascript” src="<?php echo sc_url_library("prj", "mqtt", "paho-mqtt-min.js"); ?>">
<?php

bye

Hi, thanks! I am using it in a blank app… and still have problems! My code is the following:

?>

    <script src="<?php echo sc_url_library("prj", "STL", "lib/stl_viewer.min.js"); ?>"></script>
 
    <script>
        var stl_viewer=new StlViewer
        (
            document.getElementById("stl_cont"),
            {
                models:
                [
                    {filename:"/opt/NetMake/v9-php73/wwwroot/scriptcase/test/Nasa.stl"}
                ]
            }
        );
    </script>
    
</body>
<?php But it doesn't work... no file is shown. If I use the same code in a html file (well, replacing the script script src="stl_viewer.min.js"></script) , it works properly...