Skip to Main Content

Programming Languages & Frameworks

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bookmark Calling Remote Js File

George SamaanJun 22 2016 — edited Jun 24 2016

Dears

I have created the following bookmark in IE 11:

javascript:(

function george() 

{

var script = document.createElement('script');

script.type='text/javascript';

script.onload = function() {georgeee()};

script.src = 'http://mycompany/measurement.js'+ 

Math.floor((new Date).getTime()/3600000000);;

document.body.appendChild(script);

}

)();

measurement.js contain the following:

javascript:(function georgeee()

{

var oShell = new ActiveXObject("WScript.Shell");

var oExec = oShell.Exec

(

'powershell.exe -Command " & { $port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one ; $port.open() ; $port.ReadLine() ; $port.Close() ; [Environment]::Exit(1) } "'

);

Output = oExec.StdOut.ReadAll(); 

var substroutput = Output.substr(8,5);

document.getElementById('measureSrcContainer&# 39;).value = substroutput;

})();

But it is not working though putting the code of measurement.js directly in the bookmark it is working.

Comments

843798
Nearly all users' machines will have a JRE already installed. In fact, Microsoft is causing quite a stir by not including a JRE in Windows XP!
843798
That is a legitimate issue, and the answer is yes you have to force them to install the JRE one way or another. On the other hand, the reason your application is 100k is probably because the JRE is so large - I.E., the JRE wraps up all the code that you didn't have to write. Besides, nowadays 5MB is not that large.
1 - 2

Post Details

Added on Jun 22 2016
1 comment
1,350 views