LinkedIn integration instructions provide the following syntax:
we say, WTF? what kind of script tag has a src attribute and content as well?
It turns out that the JS in the src attribute is pulling those lines out of the DOM and parsing them. It is not really JS inside there, but a language specific to in.js. Wow, that’s cryptic and unexpected.
What is a better way to pass arguments into scripts like this one?
Our method at work, so far, is
- Inside the included script, do nothing except define a giant function.
- Inside another script tag (this one with no src attribute), call that giant function, passing in whatever arguments it needs.
This allows us to pass in values that may be filled in by, say, our velocity template.
Anybody have a cleaner pattern?