Off-Device Debugging

With a few manual configuration steps, you can run and debug your Link for Web app on a desktop Chrome browser. Link Libraries will call a specified target device over the netowork, allowing you to exercise all of the same functionality as if it were running on the device's Link embedded web browser.

Note: The latest desktop versions of Chrome support many features not supported by the Link embedded browser, so be sure to avoid those when developing your app. Also, be aware that the header/footer functions of the embedded Link browser will not be available.

Enable CORS on the target device

When using the HPKTool to install you app on a device, the tool will automatically enable CORS and add your app's domain to the device's Trusted Sites List.

But for off-device debugging, these steps will need to be done manually using the device's EWS as follows:

  1. Sign in
  2. Navigate to the Security Tab
  3. Navigate to the Web Services Security page
  4. Check the box at the top of the page
  5. Add you app's domain to the trusted sites list (e.g. *.mydomain.com)
  6. Click Apply at the bottom of the page

 

Configure the web proxy settings on the target device (if required)

If your networking environment requires a web proxy to reach the internet, you will need to configure the web proxy settings on the target device. See how here.

 

Initialize the linkbase library to reference the target device

Modify your app's code to initialize the linkbase library to specify the optional deviceTargetName (IP Address or Hostname) and deviceTargetPassword (the device EWS admin password, if set).


function Initialize(){
	linkbase.Initialize("192.168.0.2","abc123").then(
		function(){
			// Now you can debug in Chrome on your desktop
		},
		function(err){
			// Some error occurred
		}
	);
}


 

Debug Your App

Now you can use Chrome's developer tools console to run, edit, and debug your app in real-time. Just load your web app into the Chrome browser, open the developer tools console and start debugging.

Note: You may encounter comunication errors due to the browser's inability to verify the device's self-signed SSL certificate. To work around this issue, first load the device's EWS page into the browser, bypassing any security warnings.

When initialized as described above, the linkbase library will:

  • route all Link library API calls to the target device (over the local network)
  • automatically establish an app UI context, loading a "device in use" page on the device's front panel

 

 

Note: The "Device In Use" page can only be launched when the device is showing its home screen. So if you need to reload your web app into Chrome (initiaizing the linkbase library again), you will first have to press the home button on the device.