473,508 Members | 2,489 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 8081
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="javascript">
<!--
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_SPAM_4_MEyahoo.com> wrote in message
news:Ok**************@TK2MSFTNGP10.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="javascript">
<!--
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
3443
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...
0
15175
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...
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...
38
23942
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...
4
1748
by: Aaron | last post by:
is there a way to remove all white spaces in the html output? ie. everything as one line.
4
3569
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....
5
2554
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...
6
7964
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,...
2
3849
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...
5
13957
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...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7133
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...
0
7405
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...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5643
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,...
1
5059
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...
0
4724
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...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.