Please explain me what this javascript code does
I have a javascript with the following code:
caburl="http://"+top.window.location.host+"/ims.cab";
cabver="1,1,1,5";
document.write("<object id='IMS' width=0 height=0 classid='CLSID:8246AC2B-4733-4964-A744-4BE60C6731D4' codebase='"+caburl+"#version="+cabver+"' style='display:none'></object>");
From the above lines, I can understand that the first line specifies the location of cab file. Second开发者_开发技巧 Line specifies the cab file version.
Can anyone please explain me, what the third line does..which starts with Document.Write....
I dont have any knowledge of Javascript and want to convert the task performed by this javascript into my exe file.
Expecting a quick and positive response.
The third line writes the generated string value to the page (concatenating strings with the values of the caburl
and cabver
variables).
This adds an object
element to the page with the values in the string.
From the value classid
and the use of cab
in the variable names, I would deduce this is an ActiveX component (so would only work on IE). This is normally used for installing the component on the client computer.
It joins a string together to make an html tag, and then using document.write appends it to the HTML document.
The third line writes the string enclosed inside the write() function into the document being displayed in the browser.
Note that because of the style='display:none'
text in the string , the <object>
won't be visible in the browser.
The code will install Java CAB file called "ims.cab" hosted on some server. See this question as well for reference: extract cab file and execute the exe file(inside the cab file) automatically
To do this with EXE of your own, you can take a look here: http://www.codeproject.com/KB/files/CABCompressExtract.aspx
Let us know what language you intend to use (C++, C# etc) for further help.
精彩评论