Question about Client scripts: We have a bundle i...
# suitescript
s
Question about Client scripts: We have a bundle installed that has a bug in one of the client scripts. I have made a copy of the code and am trying to deploy my copy, and simultaneously undeploy the other script. The script deployments show that the original script is undeployed, but the old, broken code continues to run on the record form anyway. I assumed it was a caching issue and fully cleared the cache in two different browsers, but the old code continues to run. It is undeployed and set to Testing (the owner is someone else other than me). Any idea why, or how to stop this? The bundle is locked so I can't modify the code directly, otherwise I would have done that instead.
m
Have you checked to see if the script file is actually attached to the form? The form may have a custom code section, and any script referenced there won’t even need to be deployed to ruin your day.
s
We decided to workaround the problem in a different way. The reason it breaks is because of a ham-fisted attempt at browser-sniffing (it looks for "Chrome" in the user agent string. Anything not containing Chrome is assumed to be Internet Explorer). So, we are going to have our users use a browser extension to override the browser user agent string for *.netsuite.com pages to add "Chrome" at the end. That should hold us over until the vendor fixes the issue in their script. I feel like I shouldn't have to play user agent spoofing games in 2019.
t
I just came in and haven't read the full thread yet but that sounds awful
s
The bundle is more than five years old. How they have gone this long without having customers use a browser other than IE or Chrome amazes me. Safari and Firefox may not be the most popular browsers, but they are still quite common. I am interested to hear what their engineers have to say about that.
t
Why would they assume that any non-Chrome is IE. Even if I was in their situation, I would have assumed any non-IE browser is Chrome.
Does your spoofing completely fix the issues?
Though I'm just starting out and working on a new app. Avoiding pitfalls is hard with this. It does feel like I need to do some hacky stuff to get somethings working.
s
It does fix it, but I don't like it. Generally, feature detection is the way to go:
Copy code
if ('showModalDialog' in window) { ... }
else if ('open' in window) { ... }
of course, that is not what their code does. And I agree that assuming non-Chrome browsers all support a particular feature is a bad assumption. In particular, feature support changes in the same browser from one version to another, which is why they shouldn't make those assumptions.