Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/23665-ajax-and-decompression/
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.
[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.
[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 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.