Jump to content


Photo

Ajax and de/compression


  • Please log in to reply
5 replies to this topic

#1 satya61229

satya61229
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts
  • LocationBangalore, India

Posted 11 October 2006 - 01:50 PM

Hello Friends

My question is about usability of Ajax.

I am a PHP developer.
With PHP you can do http compression like gzip.
I think you can do this with other scripting language also.

Now my problem is compression does not work with Ajax. Reason is understandable.

My query is how to use the compression technology with Ajax.
Is there is a way to decompress the content with js which was compressed with
ob_start("ob_gzhandler");


I tried to find out this on google, but lastly I have to post it here for my expert friend.

Thanks & Regards
Satya Prakash


#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 11 October 2006 - 02:19 PM

Is there a reason you can't decompress it in the backend and then just pass the decompressed contents back to the page? 

Info: PHP Manual


#3 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 11 October 2006 - 04:46 PM

Now my problem is compression does not work with Ajax. Reason is understandable.


Like ober implied, gzip compression works fine on ajax requests. The browser will decompress anything that has an Encoding: Gzip header. Using ob_gzhandler as a callback for outputbuffering should include this HTTP header automaticly.

#4 satya61229

satya61229
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts
  • LocationBangalore, India

Posted 12 October 2006 - 07:48 AM

Is there a reason you can't decompress it in the backend and then just pass the decompressed contents back to the page? 


I want to use compression.

#5 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 12 October 2006 - 09:02 AM

I want to use compression.


That we've established. Like I said, gzip works fine with ajax requests. Why do you say it doesn't work?

Here's a link that tests XmlHttpRequest capabilities, you'll see that it supports Gzip on on at very least IE and FF.

#6 satya61229

satya61229
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts
  • LocationBangalore, India

Posted 12 October 2006 - 09:18 AM

I want to use compression.


That we've established. Like I said, gzip works fine with ajax requests. Why do you say it doesn't work?

Here's a link that tests XmlHttpRequest capabilities, you'll see that it supports Gzip on on at very least IE and FF.

<hr>
Thank you.
Now I know I have to do something with Content-Coding when I want to use ob_start("ob_gzhandler");

Thanks






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users