Digital Media Suite API Forums

« Back to Digital Signs API Forum

DMP 4400 and HTTP Status Codes

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
I'm developing a system intended to update content and handle errors, solely from the client side, via AJAX. The DMP is only responsible for loading a web page from a fixed path. The page itself loads content into an iframe, and then runs a Javascript interval to periodically check the date headers of a watched file which will indicate whether the content within the iframe needs to be refreshed.
 
In the event that the periodic request fails, and the XMLHttpRequest returns an HTTP code other than 200 (success), the page will redirect to an error page stored locally on the DMP or other computer/applicance. This method has worked within most popular browsers.
 
However, it has not worked on the DMP. Further tests have revealed that, unlike the other browsers tested, the DMP's browser is not returning an error code, and continues to return 200 on each check even with the loss of a network connection.
 
Beyond the specific methods of error handling I've described, our goal is to have the DMP recognize that it's lost a network connection, and respond by loading a local page. We've tried the Failover URL setting within the DMP's administrative interface, but as far as we can tell, it's only triggered when the DMP is specifically given the command to load the primary URL. This is not triggered by periodic checks of a URL performed by Javascript within the browser.

The dmp runs a Mozilla engine, which isn't really modified, so Javascript functionality should only depend on the Mozilla version. We may be able to determine this if you could provide the firmware version that you are running. It would also be helpful if you could provide some sample code.

 
Product ID: DMS-DMP-4400
Firmware Release Version: 5.2
Build Date and Time: Wed Dec  9 15:18:45 PST 2009
 
 
 

function get_header()
{
var httpRequest = create_request_object();
httpRequest.open("HEAD", dummy_path + "?" + Math.random(), true);
var requestTimer = setTimeout(function(){ httpRequest.abort(); errorHandler(); get_header(); }, maximum_waiting_time);
httpRequest.onreadystatechange = function()
{
if(httpRequest.readyState === 4)
{
clearTimeout(requestTimer);
if(httpRequest.status === 200)
{
successHandler();
}
else
{
errorHandler();
}
setTimeout(function(){ get_header(); }, cycle_time);
}
};
httpRequest.send(null);
};

Testing the code that you provided, it is not able to trigger a successHandler or errorHandler. When the target of the XMLHttpRequest object can¿t be reached, the request¿s readyState goes to 4 (completed), however the status member does not get filled in, and javascript throws an exception when you try to access it.

To work through this, you can surround the httpRequest.status with a try/catch block and remove the error handler call from the httpRequest.abort() timer.

OK. I'll try this and get back with the results.