0

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¡¡

tereško
  • 58,060
  • 25
  • 98
  • 150
mcartur
  • 325
  • 3
  • 13
  • What is it you want to know? how to detect IE or what you should do after you have detected IE? – Dpolehonski Sep 25 '12 at 11:17
  • Hi Dplehonsky (HttpContext.Request.Browser.Browser) i would like to know how is the best way to generate a standard html.actionlink instead of an ajax.actionlink when the user is ie. Thanks for your rapidity¡¡ – mcartur Sep 25 '12 at 11:28

1 Answers1

0

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)  
    }
}
Romias
  • 13,783
  • 7
  • 56
  • 85
mcartur
  • 325
  • 3
  • 13