The js code output by ashx under the Chrome kernel does not work

  • 2020-05-30 19:49:32
  • OfStack

public class Script
      public static void Alert(string message)
            ResponseScript("    alert('" + message + "');");
        public static void ResponseScript(string script)
            HttpContext.Current.Response.Write("<script type=\"text/javascript\">\n//<![CDATA[\n");
            HttpContext.Current.Response.Write( script );

Call in form.ashx:

Script.AlertAndGoBack(" Warm tip: repeat users! ");

As a result, in the new version 6.0 of 360, 1 does not work directly, just output

<script type="text/javascript">
    alert(' Warm tip: repeat users! ');

But in IE it's completely normal.

It turned out that the speed mode of the 360 browser called the Chrome kernel of the Google browser, so the code in the Chrome browser did not work.


// Will: 
context.Response.ContentType = "text/plain";
// To: 
context.Response.ContentType = "text/html";

Related articles: