search
HomeWeb Front-endHTML TutorialDetailed explanation of html browser automatically adding
 tag

Problem scenario:

I clicked a request on page A, opened a new page (B), and passed HttpServlet on the backend Response.getWriter().write(html) method is used to write the information into the newly opened page B; [Digression: The reason for this is to solve the problem of the newly opened page being intercepted by the browser]

But there is no problem in IE6, 7, 8, ff; but in chrome, my newly written content is actually placed in the

 tag; <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/194/2dca1e20198ed7fa37b2e8461817f576-0.jpg?x-oss-process=image/resize,p_40" class="lazy" alt="Detailed explanation of html browser automatically adding <pre class="brush:php;toolbar:false"> tag"><br></p><p><strong>About html <pre class="brush:php;toolbar:false"> tag: <excerpted from: w3school></excerpted>

pre element can define pre-formatting ized text. Text enclosed in a pre element usually preserves whitespace and newlines. The text will also be rendered in a fixed-width font.

 A common application of tags is to represent computer source code. <p style="margin-top:12px; margin-bottom:0px; line-height:18px; font-family:Verdana,Arial,Helvetica,sans-serif"><strong> Thoughts on the problem: </strong></p><p style="margin-top:12px; margin-bottom:0px; line-height:18px; font-family:Verdana,Arial,Helvetica,sans-serif">After discovering this problem, the first thing I thought of was: This should be because different browsers process code text information differently, chrome My form is displayed on the page as text. And <span style="color:#ff0000"> is not an element in html format; so I think everything should be fine once this problem is solved. </span></p><p style="margin-top:12px; margin-bottom:0px; line-height:18px"><span style="font-family:Verdana,Arial,Helvetica,sans-serif">At this time, I thought of the setting of html</span><span style="font-family:微软雅黑,Verdana,sans-serif,宋体"><span style="font-size:14px">meta information</span></span></p><p style="margin-top:12px; margin-bottom:0px; line-height:18px; font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="font-family:Tahoma; line-height:18px"> <meta http-equiv="<span style=" color:>Content-Type</span>" content="</span><span style="font-family:Tahoma; line-height:18px"><span style="color:#ff0000">text/html</span></span><span style="font-family:Tahoma; line-height:18px"> ;char<a href="http://www.php.cn/code/8209.html" target="_blank">set</a>=utf-8"
 /> Setting this <a href="http://www.php.cn/wiki/169.html" target="_blank">attribute</a> should solve the problem. </span><br></p><p style="margin-top:12px; margin-bottom:0px; line-height:18px; font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="font-family:Tahoma; line-height:18px; background-color:rgb(255,255,255)">After checking the document, it suddenly became clear: </span></span></p><p style="margin-top:12px; margin-bottom:0px; line-height:18px; font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="font-family:Tahoma; line-height:18px"></span></span></p><p style="padding-top:0px; padding-bottom:0px; margin-top:0px; margin-bottom:10px; font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="padding:0px; margin:0px; color:rgb(229,51,51)"><span style="padding:0px; margin:0px; color:rgb(0,0,0); background-color:rgb(255,255,255)">1. text/html is the text in html format </span></span></p><p style="padding-top:0px; padding-bottom:0px; margin-top:0px; margin-bottom:10px; font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="padding:0px; margin:0px; color:rgb(229,51,51)"><span style="padding:0px; margin:0px; color:rgb(0,0,0); background-color:rgb(255,255,255)">2. text/plain is unformatted Text</span></span></p><p style="padding-top:0px; padding-bottom:0px; margin-top:0px; margin-bottom:10px; font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px">3. text/xml ignores the encoding format specified by the xml header and defaults to us-ascii encoding</p><p style="padding-top:0px; padding-bottom:0px; margin-top:0px; margin-bottom:10px; font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="padding:0px; margin:0px; color:rgb(229,51,51)"><span style="padding:0px; margin:0px; color:rgb(0,0,0); background-color:rgb(255,255,255)">4. application/xml will Encode according to the encoding format specified by the xml header </span></span></p><p><strong> Solution: </strong></p><p style="margin-top:12px; margin-bottom:0px; line-height:18px; font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-family:微软雅黑,Verdana,sans-serif,宋体; font-size:14px"><span style="font-family:Tahoma; line-height:18px"></span></span></p><pre class='brush:php;toolbar:false;'>response.setHeader("Content-Type", "text/html");

The above is the detailed content of Detailed explanation of html browser automatically adding

 tag. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML超文本标记语言--超在那里?(文档分析)HTML超文本标记语言--超在那里?(文档分析)Aug 02, 2022 pm 06:04 PM

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

Ubuntu Linux中如何删除Firefox Snap?Ubuntu Linux中如何删除Firefox Snap?Feb 21, 2024 pm 07:00 PM

要在UbuntuLinux中删除FirefoxSnap,可以按照以下步骤进行操作:打开终端并以管理员身份登录到Ubuntu系统。运行以下命令以卸载FirefoxSnap:sudosnapremovefirefox系统将提示你输入管理员密码。输入密码并按下Enter键以确认。等待命令执行完成。一旦完成,FirefoxSnap将被完全删除。请注意,这将删除通过Snap包管理器安装的Firefox版本。如果你通过其他方式(如APT包管理器)安装了另一个版本的Firefox,则不会受到影响。通过以上步骤

web前端笔试题库之HTML篇web前端笔试题库之HTML篇Apr 21, 2022 am 11:56 AM

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

mozilla firefox可以卸载吗mozilla firefox可以卸载吗Mar 15, 2023 pm 04:40 PM

mozilla firefox可以卸载;firefox属于第三方浏览器,如果不需要,完全可以卸载。卸载方法:1、在开始菜单中,依次点击“Windwos系统”-“控制面板”;2、在“控制面板”界面中,点击“程序和功能”;3、在新界面中,找到并双击火狐浏览器图标;4、在卸载弹窗中,点击“下一步”;5、点击“卸载”即可。

火狐浏览器Firefox 113 新特性:支持AV1动图、增强密码生成器和画中画特性火狐浏览器Firefox 113 新特性:支持AV1动图、增强密码生成器和画中画特性Mar 05, 2024 pm 05:20 PM

近日消息,Mozilla在发布Firefox112稳定版的同时,也宣布下个主要版本Firefox113进入Beta频道,支持AV1动图、增强密码生成器和画中画特性。火狐浏览器Firefox113主要新功能/新特性如下支持AV1格式动图(AVIS)通过引入特殊字符来增强密码生成器的安全性增强画中画功能,支持后退、显示视频时间,能更轻松地启用全屏模式为Debian和Ubuntu发行版提供官方DEB安装文件更新书签导入功能,默认情况下支持导入书签的图标在支持的硬件上默认启用硬件加速AV1视频解码使用w

HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

总结HTML中a标签的使用方法及跳转方式总结HTML中a标签的使用方法及跳转方式Aug 05, 2022 am 09:18 AM

本文给大家总结介绍a标签使用方法和跳转方式,希望对大家有所帮助!

Scrapy中如何使用Mozilla Firefox来解决扫码登录的问题?Scrapy中如何使用Mozilla Firefox来解决扫码登录的问题?Jun 22, 2023 pm 09:50 PM

对于爬虫爬取需要登录的网站,验证码或扫码登录是一个很困扰的问题。Scrapy是Python中一个非常好用的爬虫框架,但是在处理验证码或扫码登录时,需要采取一些特殊的措施。作为一个常见的浏览器,MozillaFirefox提供了一种解决方案,可以帮助我们解决这个问题。Scrapy的核心模块是twisted,它只支持异步请求,但是一些网站需要使用cookie和

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools