While I haven't confirmed this, it seems likely that Safari for Mac is not the only browser that behaves in this manner. This behavior stems from how the browser's cache operates. When navigating back in the browsing history, Safari (and possibly Firefox too) doesn't re-request the previous page. Instead, Safari/Webkit stores a copy of the previous page in memory, allowing for quick navigation back.
In essence, Safari retains an exact copy of the page, including input values. While this can be convenient for users in normal circumstances, other browsers may adopt similar strategies in the future. Thus, it's best not to exclusively target Safari.
To resolve issues with caching during the 'A' action, disabling the cache could help by prompting the browser to reload the page and reset input values:
</p>
<pre><code>[System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public ActionResult A()
{
return View();
}
If the problem persists, clearing values with JavaScript on the webpage's onload event may be necessary (easily achievable using jQuery):
$(document).ready(function() {
$('input').each( function() {
if($(this).attr('type') == 'checkbox') {
this.checked=false;
} else {
$(this).val('');
}
}
})
Please note that the code provided is untested but hopefully serves as a helpful solution if turning off the cache for the page proves ineffective :)