views:

94

answers:

3

I was browsing the source code of some website, and noticed a dll file being used as the src of a <script>.

(view-source:http://www.yellowbridge.com/onlinelit/baijiaxing.php)

It was something like: `

Several questions:

  • I didn't know a <script> could be anything besides js. What else can it be used for?
  • Can you point me in the direction of some more information on this topic? I've tried ggoogling around, but realized that I don't know what I should be googling exactly.
  • Is this cross-platform? I mean if I were to try this on epiphany on an ubuntu box, would it function and serve its purpose? I'm on a windows box right now and won't have access to anything else for a while, so I can't test it myself.
+5  A: 

Actually the file you are referring to 'yellowbridge.dll' is a javascript file itself. You can view the source of this file.

It might be the dll that generates javascript code.

rahul
+2  A: 

If you think of what src-attribute stands for (source) it might be easier to understand. Just like the src-attribute of the img-element you should be able to include the source-code directly in the attribute. Wikipedia got a pretty good article about data URI scheme where you could get started learning more.

In the case of the site you are linking to I guess the DLL generates JavaScript and sends it to the UA.

EDIT: This do not work in older versions of IE though. I know IE8 is said to support it. I am however not sure about IE7.

anddoutoi
+3  A: 

Only JavaScript can be used as the client-side scripting language (and VBScript too, in IE). The src attribute just specifies some URL, and that URL will return the JavaScript.

So, the URL http://www.yellowbridge.com/lib/yellowbridge.dll actually does return JavaScript. If you save its contents as a local text file, you can read the script.

Without knowing anything about the site or its JavaScript, I would guess they are dynamically generating some part of the script file from the DLL.

Edit: actually, looking at generated JS, I guess it's dynamically compressing the script on its way to the client.

harto
I wonder if the Javascript code is static (I guess, as there are no parameters), and if so, why they bother to dynamically generate it; or, at least: appear to do so.
bart
Judging by the appearance of the script, it looks like it's been compressed or minified. Perhaps the server performs on-demand script minification.
harto