I'm running into some bizarre behavior with JavaScript in Mobile IE 6.
I have an ASP.NET MVC 3 Web App, designed primarily for Mobile IE6 (WinMo 6.5 devices)
I have 2 Session variables. The first one simply contains a "0" or "1" and I can access it by doing something like this in JavaScript:
var lbType = '<%= HttpContext.Current.Session["myVar"] %>';
I can use it, display it in an alert, whatever... that works, no problem.
The other session variable is also a string, but is a bit longer (roughly 250 characters) and has some embedded \r\n (end of line characters). If I use basically the exact same code in JavaScript:
var lbData = '<%= HttpContext.Current.Session["myData"] %>';
It kills the Javascript and the rest of the page renders without executing the JavaScript. I can't work with it or display it in an alert.
Now, extra weirdness... I copied the string that I'm generating server side and sticking in the session, and pasted it into a local JavaScript variable, like so:
var lbData = 'lots of data\r\nmore data\r\nmoredata\r\nmore data\r\n';
and it works fine. I can work with it, show it in an alert, whatever I need to do.
The problem is, I can't hardcode the string. I need to generate it serverside and feed it to the javascript.
Any thoughts?
p.s. I have also successfully displayed the contents of the Session variable on the page by injecting it into the HTML (but that doesn't do me any good other than seeing it)