Javascript $.getScript inconsistencies

  • 0
  • 1
  • Question
  • Updated 5 months ago
  • In Progress
I'm inserting javascript into a form using the img onload method  (   https://community.quickbase.com/quickbase/topics/how-do-i-setup-the-image-onload-technique-iol ) which is great work by Dan Diebolt, but the results aren't consistent in various browsers and difficult to debug from within developer tools. F5 (reload) doesn't trigger the script in firefox but does in chrome. 

What's the reason that I can't insert a javascript file directly? It would be so much easier.
Photo of Jeroen van Drie

Jeroen van Drie

  • 116 Points 100 badge 2x thumb

Posted 9 months ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,254 Points 20k badge 2x thumb
Placing your JavaScript into a code page should be the last thing you do. Normally you develop the script by working exclusively in the console as it is faster than updating the code page repeatedly. 

There is nothing inconsistent about how $.getScript() works. The jQuery team has pounded out any problem with it years ago. You can use Shift F5 to force a cache reload. See:

https://stackoverflow.com/questions/20569394/whats-the-difference-between-f5-refresh-and-shiftf5-in-...

>What's the reason that I can't insert a javascript file directly? It would be so much easier.

I agree. That questions would have to be answered by QuickBase directly. The IOL technique is a workaround for this limitation.
Photo of Jeroen van Drie

Jeroen van Drie

  • 116 Points 100 badge 2x thumb
Hi Dan, thanks for all the great work in unlocking js for the community, if it wasn't for that I'd have to say "no can do" far too often, and now each time its maybe and then yes.

How do you mean don't place the js in a code page, that's the ultimate location to place it in though isn't it? My workflow now is to download a page locally, insert the js inline and then work on it until its good and then place it in a code page. Still the ability to use the developer tools on live code would be helpful. Do you know why QB isn't opening this up more, I can understand that they don't want to support it which makes sense but  js vastly enhances QB's capabilities. Still, pretty happy with your solution!
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 27,694 Points 20k badge 2x thumb
>How do you mean don't place the js in a code page, that's the ultimate location to place it in though isn't it?

Ultimately you would place your code into a code page. However, it is faster to just paste code into the console during development while refining and debugging your code. There are many benefits to working in the console because you can use all the development tools to debug, inspect,  override..

>Do you know why QB isn't opening this up more, I can understand that they don't want to support it which makes sense but  js vastly enhances QB's capabilities.

I can't speak for QB's motivations. With regard to extra support, using JavaScript with QuickBase should actually lessen the support because the JavaScript ecosystem provides an enormous tools, utilities and libraries that is supported by the browser manufactures, framework and library authors.

I like your statement:
JavaScript vastly enhances QB's capabilities
(Edited)