Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How to make whitespace suppression work

Posted on 2004-10-26
Medium Priority
Last Modified: 2013-12-24
I have read the threads on white space suppression, but they do not explain
what the cfprocessingdirective tag does.

I am using the the <cfprocessingdirective> tag as follows:

<cfprocessingdirective suppresswhitespace="yes">
... all my html and CF code within the html <body> tags ...

There are no <cfinclude> tags within the cfprocessingdirective tags.

In CF admin, I have checked "Enable white space management" and I restarted CF after setting it on.

When viewing source, I can see the total white space and count the characters by pasting it into MS Word. After adding in the tags, there is not a single white space character removed from the count according to the Word character count.

What whitespace does this tags suppress and does it work independent of the CF admin setting?
Question by:451ls
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 21

Expert Comment

ID: 12414497
LVL 21

Expert Comment

ID: 12414522
Hi 451ls,
Summery of the previous link:

1) CF server produces the white space while computing/evaluating the CF tags in html, and produces white spaces instead of the coldfusion tag for browser.
As browser does ignores white spaces it will be not displayed to you but when you see the srouce those white spaces are there instead of the coldfusion code you have in the code.

This white spaces can be removed using this tag.

2) If you have manually put the white spaces then It will not remove those white spaces there. They will be there.
This will only remove other white spaces.

More info is in the link above... If I will type here will be repeating them.

LVL 21

Expert Comment

ID: 12414576
Hi 451ls,
>>> What whitespace does this tags suppress and does it work independent of the CF admin setting?
No. They work together and as per your description you have done things correct and it should work. I am thinking.


Accepted Solution

sigmacon earned 500 total points
ID: 12414645
Quite frankly, after over 5 years with CF I have not seen any of there white-space removal solutions work. Here are a couple pointers based on my experience regarding white space:

A) It doesn't matter, don't waste time on it

B) Sometimes it's a good thing when people try to look at the source of your page and all they see is blank ;-)

C) Instead of trying to remove whitespace, don't create it! use <cfsetting enablecfoutputonly="yes"> before sections of your code that don't have inline HTML. Don't forget to turn it off before inline HTML: <cfsetting enablecfoutputonly="no">. I have several of those statements all over my code.

D) Use NewAtlanta's BlueDragon instead, there white-space removal works

E) Write your own custom tag to do that - If that's really what you want, I'll dig an old one up and post it here, let me know. Note that this approach may add significant processing time.
LVL 35

Assisted Solution

mrichmon earned 500 total points
ID: 12415297
In general if you don't have tons of whitespace you won't notice a difference.

The times you will notice it is when your page is significant whitespace - such as a page I saw this week that was 1.5MB in file size and that was all whitespace except for about 1K of text.

In that case it was recommended to the developer that he turn on the whitespace removal and it worked in that case to reduce the  page size.

Otherwise if you are not in an extremem case I would go with either A or C of sigmacon's solutions/suggestions.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
What You Need to Know when Searching for a Webhost Provider
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question