Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Friday, October 25, 2013

IE11 and Windows 8.1 : Solution for __doPostBack and Ajax not working

When we tested our website against latest IE 11 browser then we came to know that our website is not working properly against IE 11 browser.

I tried to find out on the solution for this issue and i found out following ways which will help us to resolve issue on IE 11 browser.

​Following Steps are performed to fix IE 11: ajax and __dopostback issues:
You can upgrade to .net framework 4.5 which will help us to resolve issue. If you can not update then we have some temporary alternative solution.

There are 2 solutions:

1. Site Level Fix:

Nuget has provided an update for the browser, you can execute the co

   step 1: Perform Steps from following links
        http://www.nuget.org/packages/App_BrowsersUpdate/
  
   step 2: In ie.browser add mentioned settings from following link

In your project, add to (or create as) App_Browsers/ie.browser, the following:

<!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko -->
<browser id="IE11Preview" parentID="Mozilla">
    <identification>
        <userAgent match="Trident/(?'layoutVersion'\d+).*rv:(?'revision'(?'major'\d+)(\.(?'minor'\d+)?))" />
        <userAgent nonMatch="MSIE" />
    </identification>

    <capabilities>
        <capability name="browser"              value="IE" />
        <capability name="layoutEngine"         value="Trident" />
        <capability name="layoutEngineVersion"  value="${layoutVersion}" />
        <capability name="isColor"              value="true" />
        <capability name="screenBitDepth"       value="8" />
        <capability name="ecmascriptversion"    value="3.0" />
        <capability name="jscriptversion"       value="6.0" />
        <capability name="javascript"           value="true" />
        <capability name="javascriptversion"    value="1.5" />
        <capability name="w3cdomversion"        value="1.0" />
        <capability name="ExchangeOmaSupported" value="true" />
        <capability name="activexcontrols"      value="true" />
        <capability name="backgroundsounds"     value="true" />
        <capability name="cookies"              value="true" />
        <capability name="frames"               value="true" />
        <capability name="javaapplets"          value="true" />
        <capability name="supportsCallback"     value="true" />
        <capability name="supportsFileUpload"   value="true" />
        <capability name="supportsMultilineTextBoxDisplay" value="true" />
        <capability name="supportsMaintainScrollPositionOnPostback" value="true" />
         <capability name="supportsVCard"        value="true" />
        <capability name="supportsXmlHttp"      value="true" />
        <capability name="tables"               value="true" />
        <capability name="supportsAccessKeyAttribute"    value="true" />
        <capability name="tagwriter"            value="System.Web.UI.HtmlTextWriter" />
        <capability name="vbscript"             value="true" />
        <capability name="revmajor"             value="${major}" />
        <capability name="revminor"             value="${minor}" />
    </capabilities>

</browser>


Once you perform above mentioned steps, your issue will be resolved.

2. Machine Level Fix:


   Step 1: Download patch from following link.
     http://support.microsoft.com/kb/2836939
   Step 2: install patch

   Main Source: http://www.hanselman.com/blog/IE10AndIE11AndWindows81AndDoPostBack.aspx

With the help of above fixes you can fix issue.

Happy Coding!!

Friday, June 7, 2013

javascript don't execute after partial postback

If you are doing partial postback in your page then code on $(document).ready() function will not execute.

You will experience when page loads then your javascript functionality works but after partial postback your code is not working

For resolve this issue you need to write code in following format.

Write general code in SetLocalValues() function which you want to call on $(document).ready() function

var prm = Sys.WebForms.PageRequestManager.getInstance();prm.add_endRequest(function () {//Write your code here//This function executes after partial postback so you need to call $(document).ready() functions code here});
$(document).ready(function () {        SetLocalValues();});
var prm = Sys.WebForms.PageRequestManager.getInstance();prm.add_endRequest(function () {        SetLocalValues();});function SetLocalValues() {//Write your code}
This way i have resolved javascript issue.

Happy Coding!!