AndersDJohnson / htmlcompressor

Automatically exported from code.google.com/p/htmlcompressor
Apache License 2.0
1 stars 0 forks source link

google website optimizer pages don't work when using htnl compressor taglib and compressJavaScript="true" #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add some javascript in your file like google suggests
2. render the compressed jsp

What is the expected output?
I expect google website optimizer to work

 What do you see instead?
Google website optimizer says your code is invalid, I expected var n=... but I 
saw var l=...

What version of the product are you using? 
0.9.1

On what operating system?
OSX, Linux 

Please provide any additional information below.
Here is an example exceprt from wso:
<script>utmx_section("searchbox")</script>
// Section of page to be variant tested
</noscript>

The noscript marks the end of the section in question.  There is no open tag 
for the noscript only a close tag.

Original issue reported on code.google.com by jeff%kre...@gtempaccount.com on 7 Jun 2010 at 10:08

GoogleCodeExporter commented 8 years ago
Sorry, it is not clear what is the problem here. Could you please provide exact 
piece of page source before and after a compression? 

Original comment by serg472@gmail.com on 9 Jun 2010 at 5:49

GoogleCodeExporter commented 8 years ago
Google says stick this in your page
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='1466590057',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return 
c.substring(i+n.
length+1,j<0?c.length:j)}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime=
'
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script -->

That code is in a JSP that is being compressed using htmlcompressor taglib

When google loads the page it complains with something like
expected <!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='1466590057',d=document .....

found <!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var a='1466590057',b=document

Original comment by jeff%kre...@gtempaccount.com on 17 Jun 2010 at 2:58

GoogleCodeExporter commented 8 years ago
Do you have inline javascript compression on? If so you probably need to 
disable it for that piece of code as Google seems like doesn't like its 
javascript being recompressed.

Original comment by serg472@gmail.com on 17 Jun 2010 at 4:19

GoogleCodeExporter commented 8 years ago
Are you saying there is a way I can prevent the javascript from being 
compressed for this one section of my JSP and still compress any other 
javascript found in the JSP?

Original comment by jeff%kre...@gtempaccount.com on 17 Jun 2010 at 4:22

GoogleCodeExporter commented 8 years ago
It compresses only code that you wrapped into compressor tags. So you can do 
something like this:

<compress:html compressJavaScript="true">
    <html>
    ...regular code that will be compressed....
</compress:html>

<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
...
</script>

<compress:html compressJavaScript="true">
    ...rest of the page...
    </html>
</compress:html>

Original comment by serg472@gmail.com on 18 Jun 2010 at 1:38

GoogleCodeExporter commented 8 years ago
could you please add a feature for servlet filter? 

sometimes i want to compress javascript or css by any request.

I can join in to the develop list.i have write the code already based on your 
project.

Original comment by cmings.c...@gmail.com on 19 Nov 2010 at 8:58

GoogleCodeExporter commented 8 years ago
by the way,i do know how to apllication a member for development.

Original comment by cmings.c...@gmail.com on 19 Nov 2010 at 8:59

GoogleCodeExporter commented 8 years ago
@cmings.chen If you could zip your code and send it to serg472@gmail.com I can 
take a look. Thanks. 

Original comment by serg472@gmail.com on 19 Nov 2010 at 4:44

GoogleCodeExporter commented 8 years ago

Original comment by serg472@gmail.com on 26 Mar 2011 at 8:15