Hi,
Is there any way to use external js files? If yes, how? I know I can add JS script to the header/footer of a site and have done so. But it seems the functions from those scripts cannot be called from my front-end js code. I tried copying those scripts manually to the public folder, but didn’t manage to get that working either.
I’m trying to use some external libraries such as Twilio or right now trying to use javascript files as documented here or here .
@alexander-wix @sailorcihan @code-queen ?
Please note that according to the Corvid Community Guidelines , it is not permitted to tag Wix employees. Thank you.
I apologize, didn’t realize that. There’s a lot to read in the guidelines, and it’s not obvious from the bold parts/titles.
I assume the intent isn’t that you can’t tag someone in a thread he’s active in - right?
Thanks, but I’m asking about js scripts which are not available as npm modules such as in the links I shared above. Any way to work with those?
@brett-haralson could you help get an answer to this please?
@experimentnoxx No problem tagging a Wix person if they’re involved in the thread.
@brett-haralson @skmedia @giri-zano @robert-mccormick
Trying to revive this to get some TLC - I’m sure this is important for many users.
Is it possible to use external js code which is not available via NPM? Even copying the js file to the public folder would be ok, but I’m not sure how/whether instances can then be instantiated.
Is there a way to do this?
Even no is an answer, won’t leave me hanging…
Had a quick look at that bluesnap. No, you can´t. It does forms and Wix (currently) does not let you access the DOM. There are two other possibilities:
- if you need to communicate between that form and Corvid, you can use the html-component. It is basically an iframe which lets you communicate with Corvid using postMessage/onMessage. But it is a static iframe which doesn´t expand/shrink or let alone responsive
- there is something in beta-stage which plays nicer with its surrounding page elements, but … it doesn´t communicate with Corvid.
So if you need comm, try the html-component. If you need a better behaved, non-communicating element inside a Wix page, you will have to wait untill it comes out of beta.
Hope this helps.
@giri-zano Thanks, that’s informative. But I don’t necessarily need to access the DOM.
I could encrypt information locally using one of those js scripts without accessing the DOM, as described here . (that’s the second bluesnap link i shared above, looks like you only looked at the first).
So the question still stands - can I manually copy such js and use them? If so, how? I’m not sure how to get the equivalent situation which will allow me to instantiate an instance as described at the link.
@experimentnoxx You can add code to files in the site’s Public folder. See the article about Javascript Support for details on what’s supported in the code.
You might be able to use wix-fetch to interface to the API referenced in your second link . You can find some examples of using wix-fetch on the examples page . Here’s a simple example of a Weather App .
You might also want to consider using one of the built-in encryption libraries;
Feel free to request your package to be added to the Package Manager.
Just wanted to point out that client-side encryption is vulnerable. It is recommended not to expose any sensitive information in the frontend (client-side) at all, and to handle it strictly in the backend.
For more information, see the article Corvid Security Considerations .