But, when I want inspect some html parts or if I want trace a javascript behavior, I want and I prefer use Firefox and FireBug.
So, I create a fake mobile engine which use Firefoxe+firebug
First, I have added my new engine in globlal.asax.cs
In "Global.asax.cs" (full source here)
protected void Application_Start()
{
AjaxHelper.GlobalizationScriptPath =
"http://ajax.microsoft.com/ajax/4.0/1/globalization/";
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
// Add the auto mobile detection & redirection
ViewEngines.Engines.Clear();
ViewEngines.Engines.AddIPhone<RazorViewEngine>();
ViewEngines.Engines.AddWindowsMobile<RazorViewEngine>();
ViewEngines.Engines.AddGenericMobile<RazorViewEngine>();
#if DEBUG
// Just use it for debug JS in firebug & inspect HTML
ViewEngines.Engines.AddFireBug<RazorViewEngine>();
#endif
// Std engine
ViewEngines.Engines.Add(new RazorViewEngine());}
Second, I had in my custom mobile engine my new "Firefox+firebug" fake mobile engine
in CustomMobileViewEngine cs (full source here)
public static class MobileHelpers
{
...
//Add firefox + firebug for help to debug
public static void AddFireBug(this ViewEngineCollection ves)
where T : IViewEngine, new()
{
ves.Add(new CustomMobileViewEngine(c =>
c.UserAgentContains("firefox"), "Mobile",
new T()));
}
}
You could do the same thing with "F12" on IE if you are used it.
this doesnt work, if you visit the site with a full blown browser first, the view will stick...
RépondreSupprimer