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
Post Details
Added on Jun 22 2016
1 comment
1,355 views