1

The LinkedIn Getting Started page shows the following way to include a javascript file.

<script type="text/javascript" src="http://platform.linkedin.com/in.js">
   api_key: your_api_key_goes_here
</script>

My question is - how can I do this? It would be cool if I could do this:

<script type="text/javascript" src="helloWorld.js">
   inputParam: Hello World!
</script>

and then in helloWorld.js

function getParam(name) {
    /* Fill in logic here, but somehow should return "Hello World!" */
}
alert(getParam('inputParam'));
codefactor
  • 1,616
  • 2
  • 18
  • 41
  • I've never seen that used before - I didn't think anything in a script tag that has the `src` set does anything. Anyways, I'm pretty sure the linkedin JavaScript doesn't have direct access to this - a web server at linkedin processes the request, gets GET parameters, and then serves a dynamic (or static) JS file – Ian May 18 '13 at 15:54
  • This is the only place that the api_key is actually written on the .html page - and using fiddler you can see that the api_key is not sent on the request to "in.js" - And you know that the api_key is read somewhere - but how I don't know. I am guessing it is via manual DOM access. – codefactor May 18 '13 at 16:00
  • I thought the key and value were automatically sent somehow. But you're quite right - it's not sent in the request. And yeah, it looks like it's being read by the "in.js" script. I'm looking at the "in.js" source to see if I can figure it out. It's not helping that it's a minified file... – Ian May 18 '13 at 16:14
  • possible duplicate of [how the linkedin js is a valid javascript](http://stackoverflow.com/questions/11336743/how-the-linkedin-js-is-a-valid-javascript) – bummi Jun 17 '15 at 07:00

0 Answers0