Jump to content

Archived

This topic is now archived and is closed to further replies.

satya61229

Ajax and de/compression

Recommended Posts

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.
[b]Is there is a way to decompress the content with js which was compressed with
ob_start("ob_gzhandler");
[/b]

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

Thanks & Regards
Satya Prakash

Share this post


Link to post
Share on other sites
Is there a reason you can't decompress it in the backend and then just pass the decompressed contents back to the page? 

Share this post


Link to post
Share on other sites
[quote author=satya61229 link=topic=111200.msg450450#msg450450 date=1160574654]
Now my problem is compression does not work with Ajax. Reason is understandable.
[/quote]

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.

Share this post


Link to post
Share on other sites
[quote author=ober link=topic=111200.msg450465#msg450465 date=1160576398]
Is there a reason you can't decompress it in the backend and then just pass the decompressed contents back to the page? 
[/quote]

I want to use compression.

Share this post


Link to post
Share on other sites
[quote author=satya61229 link=topic=111200.msg450839#msg450839 date=1160639337]
I want to use compression.
[/quote]

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

[url=http://www.mnot.net/javascript/xmlhttprequest/]Here[/url]'s a link that tests XmlHttpRequest capabilities, you'll see that it supports Gzip on on at very least IE and FF.

Share this post


Link to post
Share on other sites
[quote author=448191 link=topic=111200.msg450853#msg450853 date=1160643744]
[quote author=satya61229 link=topic=111200.msg450839#msg450839 date=1160639337]
I want to use compression.
[/quote]

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

[url=http://www.mnot.net/javascript/xmlhttprequest/]Here[/url]'s a link that tests XmlHttpRequest capabilities, you'll see that it supports Gzip on on at very least IE and FF.
[/quote]
<hr>
Thank you.
Now I know I have to do something with Content-Coding when I want to use ob_start("ob_gzhandler");

Thanks

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.