Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Stanley Mok
152
Views
2
Comments
Solved
Javascript in public web block
Question
JavaScript
OutSystems Widgets
I am creating a web block to be reused in other applications, there is a javascript file uploaded in resources under App1 folder and linked using AddJavascript in HTTPRequestHandler. Everything works in the application where the web block resides.
When it is referenced in another application, during runtime the javascript file cannot be found because it is now supposed to be at the App2 folder.
How can the correct folder location be set in the web block so it will work in other applications?
Thanks,
Stanley
João Rosado
Staff
Solution
Hi Stanley,
If the Resourses are in App1 why doens't your url have a full path? "/App1/scripts/somejavascript.js"
(note I'm assuming from your problem that you have something like "scripts/somejavascript.js")
As a side note, check the
Integrating a JQuery plugin
page in the Academy.
Unless there are many javascript files I recommend using the block javascript approach explain there instead of the resources as it works better than the HTTPRequestHandler approach. Expecially to avoid
import order
problems between multiple libraries and will guarantiee that a script is only added once per page.
Here is also a
related topic
, check my replies there for some reasoning.
Regards,
João Rosado
1 reply
29 Sep 2015
Show thread
Hide thread
Stanley Mok
João,
Thanks for the informative links, it make sense to moved the javascript within the web block, I just do that and it works.
Thanks,
Stanley
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...