I just solved a related issue that I had been struggling with, this is that as part of an update to a plugin I had amended an associated javascript file, which was referenced in the main page. However try as I might none of the changes did anything unless I posted them directly as script in the main page.
However when I changed the path of the javascript file it all worked. So I think that the server is using a copy of the javascript file derived off it's location, and this survives an upgrade, reboot and clearing of the cache.
The correct solution would therefore be to use js and css files with a version number in their name.
Not sure whether this is documented anywhere - hence making a note here.
Announcement
Collapse
No announcement yet.
referencing plugin javascript files
Collapse
X
-
I spent an hour trying to figure this out looking at another plugin, and it was staring me right in the face the whole time
At the top of my page ...
<a href="[% webroot %]plugins/SqueezeDSP/index.html?player=[% player | uri %]">
Anyway it is working now, thanks for the pointers.
Leave a comment:
-
What I did in the past when starting on plugin development was downloads lots of existing plugins and then search for something similar.
You could download and search to see who has separate JS files and then see where they are and how they invoke them.
Leave a comment:
-
referencing plugin javascript files
Try something like the following in your page template:
[% webroot %]plugins/SqueezeDSP/html/sqdsp_data.js
This should create an absolute path to the file.
Leave a comment:
-
Cache\InstalledPlugins\Plugins\SqueezeDSP\HTML\EN\ plugins\SqueezeDSP\index.html
create another folder html below where you have index.html. Yes, it's
awful, but the html (lowercase) sub folder would be served as static files.
<script type="text/javascript" src="sqdsp_data.js"></script>
This then should become "html/sqdsp_data.js".
So the new html folder should be on this path
Cache\InstalledPlugins\Plugins\SqueezeDSP\HTML\EN\ plugins\html\sqdsp_data.js
and I should be able to reference it via
<script type="text/javascript" src= "html/sqdsp_data.js"></script>
I have tried this and it is not working. If you can confirm whether I have the above correct, if so it will be something else.
Leave a comment:
-
Originally posted by mherger View Post> Cache\InstalledPlugins\Plugins\SqueezeDSP\HTML\EN\ plugins\SqueezeDSP\index.html
create another folder html below where you have index.html. Yes, it's
awful, but the html (lowercase) sub folder would be served as static files.
> <script type="text/javascript" src="sqdsp_data.js"></script>
This then should become "html/sqdsp_data.js".no wonder I couldn't figure it out!
Leave a comment:
-
referencing plugin javascript files
> Cache\InstalledPlugins\Plugins\SqueezeDSP\HTML\EN\ plugins\SqueezeDSP\index.html
create another folder html below where you have index.html. Yes, it's
awful, but the html (lowercase) sub folder would be served as static files.
> <script type="text/javascript" src="sqdsp_data.js"></script>
This then should become "html/sqdsp_data.js".
Leave a comment:
-
referencing plugin javascript files
I am finding it very difficult to predictably locate my own javascript libraries.
for example my plugin is located on path
Cache\InstalledPlugins\Plugins\SqueezeDSP\HTML\EN\ plugins\SqueezeDSP\index.html
I have two libraries sqdsp_data.js and sqdsp_controls.js which manage calls to the server and populate controls.
if I locate them in the same folder relative to the index.html file and enter a path
<script type="text/javascript" src="sqdsp_data.js"></script>
or
<script type="text/javascript" src="./sqdsp_data.js"></script>
the files do not seem to be picked up.
Can you confirm where I should be locating these files relative to the above path?
For now I have embedded the scripts within index.html and the code is working, but I don't like this approach.
Leave a comment:
Leave a comment: