I implemented a simple visual web part with updatepanel with a button and a label. When I click on a button, OnClick event is called and the label is getting filled. This works fine in all browsers except for SAFARI browser. In safari the OnClick event is not getting called at all. I have even implemented this in an application but the result is same in safari browser. A sample asp.net application with the same structure with update panel works in SAFARI too. Only when implemented in sharepoint, the safari browser is not getting partial postback. I have checked that the scriptmanager has enablePartialMethods = true. Let me know if there is any solution for this in SAFARI.
3 Answers
seems like a common problem with the new version browsers, this has been an on going issue! things like Page.ClientScript.RegisterClientScriptBlock(...) just doesnt work due to javascript not loading properly in those browsers at the beginning as sharepoint is doing one thing and browser is doing another!
you have two methods! first i would try the following:
ISSUE
The ASP.NET AJAX UpdatePanel control must change the page’s postback behavior to enable support for asynchronous postbacks and partial rendering. However, in a SharePoint application, these modifications cause a JavaScript error. This is because SharePoint attempts to make a similar change. The SafeScriptManager control corrects the JavaScript problem.
SOLUTION
In Visual Studio, add a reference to Microsoft.Practices.SPG.AJAXSupport.dll. Add a SafeScriptManager control to your page and set the EnableUpdatePanelSupport flag to true. This changes the postback script that is needed for the UpdatePanel control to work in a SharePoint environment. The following code demonstrates how to add a SafeScriptManager control to a page.
<%@ Register
Assembly="Microsoft.Practices.SPG.AJAXSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8768CCAE1C3C9EB2"
TagPrefix="spg"
Namespace="Microsoft.Practices.SPG.AJAXSupport.Controls" %>
<spg:SafeScriptManager ID="SafeScriptManager" runat="server" EnableUpdatePanelSupport = “True”/>
<asp:UpdatePanel runat=”Server” id=”MyUpdatePanel”>
... DO YOUR STUFF
</asp:UpdatePanel>
Additional Notes
You may place several SafeScriptManager controls on your page, and it is allowed to set the EnableUpdatePanelSupport flag on each SafeScriptManager control on your page. However, when there are multiple SafeScriptManager controls on a page, only one of them must set the EnableUpdatePanelSupport flag to true in order to enable the correct postback behavior for the whole page.
http://msdn.microsoft.com/en-us/library/ff650218.aspx
if this solution doesnt work than you can try this:
you need to do the following:
create a js file.
goto desktop and create a text file, name it anything like so:
webkitFix.js
make sure you have the extension .js otherwise its still a text file!
now open the file, dont double click! just right click and open with any text editor like notepad or notepad++
now copy and past this code:
if (typeof(Sys.Browser.WebKit) == "undefined") {
Sys.Browser.WebKit = {};
}
if (navigator.userAgent.indexOf("WebKit/") > -1) {
Sys.Browser.agent = Sys.Browser.WebKit;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = "WebKit";
}
now save and exit! copy the file to a layouts folder under this location:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033
create a new folder
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\webkitfix
add the file webkitFix.js to the folder:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\webkitfix\webkitFix.js
now update the webapplication masterpage:
open with notepad or notepad++ (prefered) or sharepoint designer
now add the JS file to load first in masterpage!
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/webkitfix/webkitFix.js" />
</Scripts>
</asp:ScriptManager>
-
Thanks Ali! I was using UpdatePanel everywhere in my 2013 solution and this fixed the iPad bugs Commented Jun 24, 2014 at 17:11
-
-
Thanks for sharing the knowledge @aliSharepoint, the JavaScript thing worked for me but what if the update panel contains multiple controls? In my case, I have three buttons placed in the update panel but the button click does not update the panel. What should I do? Commented Jun 28, 2014 at 12:01
I may have a variation on this issue: Like the OP I have a very simple test page with an out of the box master page. A couple of controls in an UpdatePanel including a dropdown list with a SelectedIndexChanged event handler. Only on OSX/Safari do I get full postback on a DDL selection change.
Via JS debugging I discovered a page redirect. Fiddler revealed 401 & 302 status codes. I turned off Form authentication and now the UpdatePanel works.
This is not really an answer in my situation (it appears claim authentication requires Form authentication and I need that in production) but maybe it'll help somebody else.
Yes, I think this problem occurred when we have implemented only Windows Authentication for the web application, let try to add dummy Form authentication in this web application too (select form authentication and enter dummy membership provider), the sign in page will show you, select Windows Authentication you will see you application work well for all browsers.
Next if you need only Windows Authentication you can create custom sign in page to bypass to Windows Authentication "/_windows/default.aspx
?.." only.