IE9 JSON Data “do you want to open or save this file”

后端 未结 5 554
温柔的废话
温柔的废话 2020-11-28 08:57

Started testing my jQuery applications with IE9. Looks like I may be in for some trouble here. I noticed that when I return JSON data back to the Javascript methods I always

5条回答
  •  天涯浪人
    2020-11-28 09:46

    If anyone is using ASP.net MVC and trying to fix this issue - I used the following built in methods in the MVC framework. Simply update the content Type and encoding on the JsonResult.

    public ActionResult Index(int id)
    {
            // Fetch some data
            var someData = GetSomeData();
    
            // Return and update content type and encoding
            return Json(someData, "text/html", System.Text.Encoding.UTF8,
                            JsonRequestBehavior.AllowGet);
    }
    

    This fixed the issue for me!

提交回复
热议问题