Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that js code outputted by ashx does not work under Chrome kernel

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report