views:

56

answers:

2

greetings all i was wondering if it's possible to send some javaScript code in the response of a controller meaning that i want to invoke a javaScript but not from the jsp (from server side) something like:

var d = new Date();
var gmtHours = -d.getTimezoneOffset()/60;
var tz=gmtHours;
window.location="page?tz="+tz;

what do you think guys ?

A: 

I am still not very clear about the question. But it you are asking to invoke a javavscript when a response comes back from server than you can use AJAX and do your processing in the callback.

If you want to access the timezone than another way to send it as part of the parameter right in the beginning as a request parameter itself.

lalit
i want to get user time zone before loading a specific page (meaning in the get request of the page)
sword101
We had a similar problem in one of the project. The Http payload (including headers) do not contain time zone information by default. So we sent the time zone parameter as part of the request when we needed it. If you have clear entry points in the application, send the parameter as part of request from those pages.
lalit