Yesterday, I was prompted to upgrade IE to 360, So I upgraded the browser following the Upgrade Wizard.
However, in the Customer Information Management System (CRM) with the B/S structure originally designed, the Javascript statement originally executed on the login page was scaled down to the upper left corner of the screen under ie8.
I have always sought perfection for the program. Find a solution.
After re-designing JS statements, I thought it would solve the problem if I could correctly open the browser in my browser environment (IE8. Haha ~~
I tested it in my colleague's Computer Browser (IE6). As a result, this JS statement can only be run in IE8. IE6 also moves the browser to the upper left corner of the screen.
The solution is to execute different JavaScript codes based on the browser type of the client.
CS code:
Public class javascriptoperation {# region browser control // the browser is opened with the same screen size. // IE6 supports public static string winopenmax = "<body onload = moveTo (); resizeTo (screen. width, screen. height-30);> "; // the browser and screen size are the same. // IE8 supports public static string browsersizemax =" <script language = JavaScript> "+" window. moveTo (0, 0); "+" window. resizeTo (window. screen. width, window. screen. height-30); "+" window. focus (); "+" </SCRIPT> "; # endregion ////////////////////////////////////// /// // according to the client different types of browsers, process different httpbrowsercapabilities BC = request. browser; string bctype = BC. type; this. response. write (bctype); Switch (bctype) {Case "IE6": This. response. write (javascriptoperation. winopenmax); break; Case "IE8": This. response. write (javascriptoperation. browsersizemax); break; default: This. response. write (javascriptoperation. winopenmax); break ;}Author: Duan Liqing QQ: 14035344
Card Water and Electricity Thermal System