How to solve the problem that js code outputted by ashx does not work under Chrome kernel
This article mainly introduces how to solve the problem that the output js code from ashx does not work under the Chrome kernel. The article is very detailed and has a certain reference value. Interested friends must read it!
The code is as follows:
Public class Script
{
Public static void Alert (string message)
{
ResponseScript ("alert ('" + message + ");")
}
Public static void ResponseScript (string script)
{
HttpContext.Current.Response.Write ("\ nCompact /\ n\ n")
}
}
Call in form.ashx:
The code is as follows:
Script.AlertAndGoBack ("warm reminder: duplicate users!")
As a result, it didn't work in the new version 6.0 of 360, but it just output
The code is as follows:
/ /
/ /]] >
However, the display in IE is completely normal.
Later, it turns out that the speed mode of the original 360 browser invokes the Chrome kernel of the Google browser, so this code in the Chrome browser doesn't work either.
Solution:
The code is as follows:
/ / will:
Context.Response.ContentType = "text/plain"
/ / change to:
Context.Response.ContentType = "text/html"
These are all the contents of this article entitled "how to solve the problem that ashx output js code does not work under the Chrome kernel". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!