473,668 Members | 2,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net remove white space in html

is there a way to remove all white spaces in the html output? ie. everything
as one line.
Jul 21 '05 #1
3 8090
Aaron wrote:
is there a way to remove all white spaces in the html output? ie. everything
as one line.


Well, Response.Filter is where I'd start:

http://msdn.microsoft.com/library/de...ilterTopic.asp

But I don't know eliminating all whitespace is what you'd do, cuz you'd
have to figure out how to detect if you were inside of a tag (don't want
to just erase all spaces, etc.). You wouldn't strip out whitespace like
that.

But you could strip out things like Tab characters (if this is what you
meant). crlf's I thought were problematic when I tried it for a client
(for their pages), but I can't think of why (I thought it caused
problems in Javascript. As long as every line ends with ; the JS should
still run fine. Unless you use the <!-- // --> wrapper around
scripts, as I don't think this can go all on the same line. Example:

<script language="javas cript">
<!--
alert('hello');
// -->
</script>

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Jul 21 '05 #2
I think the following link is useful.

http://www.codeproject.com/aspnet/WhitespaceFilter.asp

"Aaron" wrote:
is there a way to remove all white spaces in the html output? ie. everything
as one line.

Jul 21 '05 #3
It sounds like he only wants to filter out line breaks, for whatever reason.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Craig Deelsnyder" <cdeelsny@NO_SP AM_4_MEyahoo.co m> wrote in message
news:Ok******** ******@TK2MSFTN GP10.phx.gbl...
Aaron wrote:
is there a way to remove all white spaces in the html output? ie.
everything as one line.


Well, Response.Filter is where I'd start:

http://msdn.microsoft.com/library/de...ilterTopic.asp

But I don't know eliminating all whitespace is what you'd do, cuz you'd
have to figure out how to detect if you were inside of a tag (don't want
to just erase all spaces, etc.). You wouldn't strip out whitespace like
that.

But you could strip out things like Tab characters (if this is what you
meant). crlf's I thought were problematic when I tried it for a client
(for their pages), but I can't think of why (I thought it caused problems
in Javascript. As long as every line ends with ; the JS should still run
fine. Unless you use the <!-- // --> wrapper around scripts, as I don't
think this can go all on the same line. Example:

<script language="javas cript">
<!--
alert('hello');
// -->
</script>

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
3473
by: Stephen Poley | last post by:
People in these groups, and on web-pages, not infrequently suggest that it is worthwhile cutting down on white-space and comments in HTML and CSS in order to reduce loading times. I and others have more than once doubted this, given the data-compression in the HTTP protocol. Having seen it suggested again a couple of times in the last few days, I decided it was time for a test on the effect of white-space. I took one of my pages:...
0
15186
by: Mark Moore | last post by:
I'm trying to layout a couple text input fields and their corresponding labels without using a table. When I was trying to debug my understanding of CSS, I was *very* surprised to see that span's with borders behave counter-intuitively (IMHO) when using style="white-space: nowrap;". Below is a fairly small chunk of XHTML that demonstrates what I'm talking about. What gives? -Mark
5
718
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting (into a text editor) the <pre> tag listing will preserve formatting (white space and line feeds). However, this is not true when doing the same with the <code> tag listing (it will all be pasted on one line with multiple successive spaces treated as a single space) despite the fact that...
38
23979
by: Xah Lee | last post by:
sometimes i wish to add white space in <p> as to achived effects similar to tab. what should i do? using empty image seems the sure way but rather complicated. (and dosen't change size with font) Woudl some of the space character in unicode work? (my html files uses unicode) Xah
4
1753
by: Aaron | last post by:
is there a way to remove all white spaces in the html output? ie. everything as one line.
4
3582
by: Andreas Prilop | last post by:
How many spaces should be displayed in A <span style="display:none">x</span> B between "A" and "B"? I notice that Mozilla displays one space and Internet Explorer (5 & 6) displays two spaces. See http://www.unics.uni-hannover.de/nhtcapri/temp/white-space.html for a cumulative effect. Why is this important? Instead of "span", think of the "rp" element
5
2566
by: Richard Maher | last post by:
Hi, Can someone please show me how to tell Firefox to preseve white-space when returning the selectList.option.value attribute? I have change the style so that the white-space is preserved on the screen, but for some bizarre reason when I try to substring out a series of bytes (aka a fixed-length string or field) from a given option it squashes everything up and corrupts the result.
6
7989
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data, call determined functions, and edit the data already present What will you need to use the grid? A table with standard markup and an ID to call the script that will turn the table into a grid Parameters: tabelaID => id of the table that will...
2
3864
by: progvar | last post by:
Hi i have not any idea how to remove white space in vb actualy i am accessing value from table some time the column is null and some time it contain space means user press space bar to remove data from that field when i access value null field executes but the field which contain white space please give some idea how i can remove executes data in both conditions or how i will remove white space thanks veer
5
13968
tharden3
by: tharden3 | last post by:
How do I remove white space around an icon? I have been using some helpful icon pics from google images to spice up a website that I'm making. In many instances though, the icon is not square, but irregularly shaped, leaving white space to make a square around the icon. In one case, I was using a 16 x 16 gif image of a movie reel (a round object) but I could not get rid of the white space around the object. How can I do this?
0
8371
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8572
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.