I am facing difficulty resizing IE11 in kiosk mode. Launching in kiosk mode forces it to go fullscreen, but turning off kiosk mode shows the toolbar & navbar, which I want to prevent a user from editing the URL. Is there a way to achieve this without using JavaScript? My attempts with JS have been unsuccessful so far.
One of my attempts involved using ProcessBuilder
, but it resulted in a save file dialog instead of resizing the window as intended.
I also tried another approach using
javascript:moveTo(0,0);resizeTo(1024,768);}
, but couldn't figure out the issue due to console being disabled in kiosk mode.
My current setup is utilizing java-8
.
private static String newUrl = replaceUserID(url);
public static void main(String[] args) {
try{
Process p = new ProcessBuilder("cmd.exe", "/c", "start iexplore -k \"" + newUrl +"\"").inheritIO().start();
resizeBrowser();
try{
p.waitFor();
}
catch( InterruptedException ie ){
System.out.println("InterruptedException " + ie.getMessage());
}
InputStream err = p.getErrorStream();
int ctr = 0;
if ( (ctr = err.available()) > 0 ){
byte[] buf = new byte[ctr];
System.out.println("Process failed with error:\n" + new String(buf, 0, ctr));
}
}
catch(IOException ioe)
{
System.out.println("InterruptedException " + ioe.getMessage());
}
}
public static void resizeBrowser() {
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine javaScript = scriptEngineManager.getEngineByName("nashorn");
try {
javaScript.eval("function resizeIE(){"
+ "newWindow = window.open(\"" + newUrl + "\", IEWindow, resizable);"
+ "newWindow.resizeTo(500,400);}");
}catch (ScriptException e) {
e.printStackTrace();
}
}