Let’s assume a simple application, which has at the top the following navigation (pseudo code):
<a href="?action=new">New</a>
<a href="?action=search">Search</a>
Below, there are different sections, i.e. for the “New” mask:
<div id="condition">
<form>
<input type="text" name="Login" />
<input type="text" name="First" />
<a href="javascript:performSearch()">Perform search</a>
</form>
</div>
<div id="results"
<table>
..
</table
</div>
Let’s assume that the session times out and the user clicks on …
- New: the content returned from the server will be loaded “full screen” and has to include header/footer/etc
- Perform search: the content will be displayed within the results DIV: should be only a short error message
Question:
- is there a way to identify via JavaScript (in the “error.html”) if the current content is loaded into a DIV or “fullscreen”?
- should I always return an element which spans the whole browser window?
- or is there a different way to handle this situation?
Any suggestions or ideas are appreciated.
I don’t think it really matters!
Not 100% sure this answers your question, but here’s what I’d do:
Have an invisible
errordiv in every page.Make it span the whole browser window.
if an error occurs when you run your JavaScript (regardless in what context!), make the error div visible:
add the error message
(of course, you’d wrap all this into one central
showError()function)if an error occurs during server-side handling, make it visible from the start (how to do that, differs from language to language).