Question

I have the following problem. As you know ie current versions do not support pushstate html5 feature. So I do not want to render my content with Ajax when the user is ie.

I guess that the best way to achieve this, is by using an extension of Ajax helper that returns the ajax.actionlink when the detected browser is not ie, and a standard (html.routelink) when the user's browser is ie.

When making the extension I am requested for the routeName which does not appear as a property...

I do not know if anyone has faced this problem and the solution you have used.

Thanks¡¡

Was it helpful?

Solution

The way i finally used for achieving what I wanted is to define a razor helper within the view. I know that it would be better to make an extension. But it was complex due to the fact that i wanted to take advantage of ajaxhelper and htmlhelper simultaneously... (So I was compelled to identify the route name and all that stuff)

@helper ConditionalLinkIE(string link, string action, string controller, object routeValues, AjaxOptions ajaxOptions)
{         
    if(ViewContext.RequestContext.HttpContext.Request.Browser.Browser.ToString().ToUpper() == "IE")
    {
      @Html.ActionLink(link, action, controller)
    }
    else
    {
      @Ajax.ActionLink(link, action, controller, routeValues, ajaxOptions)  
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top