Quote from: BobRay at Feb 04, 2016, 05:57 AMIf I'm understanding you, no matter how you do it, either the path to the JS file will be in the source, or the actual JS code will be in the source -- otherwise the browser isn't going to have access to the JS code. The JS code has to be available to the browser via URL, so it will always be accessible to anyone.
I think your best bet may be to convert the JS code to PHP and put it in a snippet. That way it will never be visible.
Thank you BobRay for the quick response,
Forgive me if I ask, but it is my understanding that a snippet is executed on page load. Once the page is loaded, you cannot use the snippet anymore but you can call another snippet by redirecting to a (no template) page using an ajax rest method, which works great except the URL shows in the address bar during the redirect. in all i did so far, it has not been an issue, but it will be an issue in this case if the username and password are displayed in the address bar.
Also, the js file only contains a couple of functions. If I convert the js file to PHP and put it in a snippet for that resource (page), how can I call the functions when needed after the page is loaded?
another thought, would it be possible to put the username and password in a hidden placeholder field which could be accessed by a TV or snippet, encrypted and returned back? if so, could you share an example on how to do it?
[ed. note: pd5023 last edited this post 8 years, 3 months ago.]