问题
We have an ASP.NET web application which uses ASP.NET Ajax. We open it from within Safari on the iPad. It works fine.
We save it to the home screen as a separate icon. We added the meta tag that makes it load in full screen, without Safari's navigation bar. It works fine.
Later, we re-open it and notice it is broken. Here is a portion of the HTML that is rendered that shows what doesn't work.
<a id="ctl00_Header1_btnHome" class="Button" href="javascript:__doPostBack('ctl00$Header1$btnHome','')" style="display:inline-block;font-size:Medium;height:35px;width:130px;">Main Menu</a>
- The inline styles are not applied. (These styles are auto-inserted by an ASP.NET *.skin file.)
- Clicking on the link doesn't work.
Re-opening the page in regular Safari, with developer tools enabled, I find a JavaScript error.
TypeError: Result of expression 'Sys.WebForms' [undefined] is not an object.
From what I gather, either the related ScriptResource.axd file is cached and not reloaded or, when reloading, some initialization event is not re-invoked.
Note: Clearing Safari's cache does the job. Sometimes, a refresh in the browser also works. Close & reload the icon on the home screen never works.
Have you solved this issue previously?
Edit: I believe this is happening because we are querying for ScriptResource.axd with parameters that are considered invalid by the webserver. It is thus responding with an error page. It escapes me why the new default.aspx would be refreshed, but it would point to a ScriptResource.axd with invalid parameters.
回答1:
Adding this to the web.config (to disable compression) seems to work.
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="true" />
</scripting>
</system.web.extensions>
回答2:
This is not a caching/compression bug. See Reasons why ASP.NET AJAX would be disabled for the correct answer.
来源:https://stackoverflow.com/questions/5681122/asp-net-ipad-safari-cache-issue