Support Request: Chrome Engine - input field focus at startup

Description

I've been looking at moving from the IE engine to the chrome engine, but when sitekiosk starts or when the logout button is pushed and sitekiosk restarts to the start page it isn't putting focus on the input field on the start page. I've tried other start pages like the ones in the forum pages below (duckduckgo & https://www.w3schools.com/jsref/met_html_focus.asp). I've tried a redirect page for the start page that waits and then starts my actual start page. The redirect works, but the focus is still not there. I've tried different hardware. I've tried different versions of sitekiosk. Nothing seems to work. The IE engine, just works for properly putting focus, but is incompatible with new webpages we are adding. The start page we use even sets focus on an interval to constantly put focus back on this one field. It seems almost like the window doesn't have focus. The browserWebView.webView.focus(); that is called out on the second forum page seems to be related to this, but it looks like a slight variation on this solution has already been added newer version of sitekiosk.

https://www.sitekiosk.com/web/CustomerSupportCenter/ArticleDetails.aspx?ArticleID=25591
https://www.sitekiosk.com/web/CustomerSupportCenter/ArticleDetails.aspx?ArticleID=23725

Has anyone else encountered this problem and found a suitable solution?

Answer: (2)

Re: Chrome Engine - input field focus at startup 7/10/2023 5:40 PM
Hello,

Thank you for your inquiry. We have revisited this issue for SiteKiosk 9.9.6466 and an immediate solution could not be found. This is considered a bug, possibly due to new features on this website. This solution may be available in a future version (no release dates on this as yet). Our SiteKiosk Online product is not affected.

You can try other JavaScript solutions with the customScriptExtension.js and DevTools in the Dev Blog links here:
https://devblog.provisio.com/post/2019/05/17/Manipulating-the-DOM-within-the-SiteKiosk-Windows-Chrome-Browser.aspx
https://devblog.provisio.com/post/2017/09/15/Debugging-Webpages-in-the-SiteKiosk-Windows-Chrome-Browser.aspx

Please email us with more details regarding your project if it was affected by this - support-america(at)sitekiosk.com

Best regards,
Andre.
Re: Chrome Engine - input field focus at startup - workaround solution 7/17/2023 9:54 PM
Here's the janky workaround I came up with. This seems to be working ok on classic sitekiosk, but will need additional testing to confirm. I'm calling an autohotkey script to click the browser screen which then sets focus properly.

1. I've implemented a redirect page as the start page for sitekiosk. This isn't strictly necessary as I also have access to the code of my startpage to call the click.exe and my startpage constantly puts focus back on the same field every second, but it will reduce what I have to change if I ever have to update my start page. If you also are constantly setting focus on your start page with something like

setInterval("document.getElementById('barcode').focus();", 1000);

then you can probably skip the redirect page and just call click.exe from your start page. If you need focus on load on a field, but don't want to force it back to that field because you have additional fields/etc. then you'll probably want the redirect page as a time buffer to make sure that the click.exe runs before the focus is called on the page the redirect start page calls and you won't have to worry about the click landing on a specific area on your page.

Redirect Page:

<html>
	<title>Local Redirect</title>
	<head>
		<meta http-equiv="refresh" content="1; URL=https://google.com">
	</head>
	<body>
	Loading...
		
		<script>
		(new Function(_siteKiosk.getSiteKioskObjectModelCode()))();
		</script>
		<script>
		siteKiosk.system.windows.skLegacy.externalApps.run('c:\\click.exe', false);
		</SCRIPT>

	</body>
</html>


*** Don't forget the double \\ in the click.exe path (i.e. c:\\Additional\\folder\\paths\\to\\exe\\click.exe)

2. The click.exe that is called on this startpage is a compiled autohotkey script. I've set the x and y coordinates to a location on the screen that clears the top browser bar of my sitekiosk configuration and clicks on the contents of the browser window. You may need to adjust these coordinates depending on the thickness/height of the top browser bars of your sitekiosk configuration or if you are not using a redirect page.


; This is the default section of a new autohotkey script. You can ignore this section and jump down to the bottom
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;This section does the mouse click that fixes the focus issue.
CoordMode, Mouse, Screen
x := 200
y := 200
Click %x% %Y%


*** If you aren't familiar with autohotkey. Download and install it. It will add some options to your context menu. Right click on your desktop and in the context menu select New -> AutoHotkey script. Once created edit the script with your text editor of choice and copy in the supplied code. Right click the script and you can run it to test its functioning or compile it. Once compiled to an exe it can be run on computers that don't have autohotkey installed.

I'll post an update if I run into any problems with this workaround and come up with something else. Best of luck.
My Account
Login
Language (Tickets):