Changing reponse header to force download

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Changing reponse header to force download

Postby markh » Tue Jan 31, 2012 1:30 pm

Hello

I am trying to force the download (rather than display) of files with a specific file extension. I need these files to download even if they reside on a server that doesn't return the correct Content-Type header. My plan was to overload OnResourceResponse and use the CefResponse parameter to change the Content-Type header to "application/octet-stream". However, it seems that the CefResponse parameter is non-modifiable in this method. In the documentation is says something about using the CefContentFilter parameter if the response needs to monitored or modified. However, it is not very clear how this should be done for what I want.

Am I even going about this the right way?

Thanks.
Mark
markh
Newbie
 
Posts: 4
Joined: Tue Jan 31, 2012 1:13 pm

Re: Changing reponse header to force download

Postby magreenblatt » Tue Feb 07, 2012 12:15 pm

You can cancel the load in OnBeforeBrowse or OnBeforeResourceLoad and then download the file yourself using CefWebURLRequest.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Changing reponse header to force download

Postby markh » Tue Feb 07, 2012 12:47 pm

Thanks - I'll give that a try.

Mark
markh
Newbie
 
Posts: 4
Joined: Tue Jan 31, 2012 1:13 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 75 guests