Skip to Content
0
Former Member
Apr 22, 2008 at 07:24 AM

Force browser to show "Save/Cancel"-Dialog without "Open"-Option

92 Views

Hi,

I have developed an application in which users can download a jar-file. Unfortunately the browser does offer an "Open"-Option, but if the user does use this option, the Java-Application does not open and nothing happens. Furthermore we need to save the file and run it locally. Is there a way to force the browser to show only the Save-/Cancel-Button. I have done some similarly in PHP in the past but I don't know how todo it in ABAP/BSP-Applications.

Best regards,

Stefan

Some Code-Snippets:

DO_REQUEST in Controller-Class:

lv_int = XSTRLEN( me->mo_application->mv_offline_jar ).

    "Get the length for the http-header.
    lv_string = lv_int.
    CONDENSE lv_string.

    response->set_header_field( name  = 'Content-Type'
                                value = 'application/java-archive' ).

    response->set_header_field( name  = 'Content-Length'
                                value = lv_string ).

    response->delete_header_field( 'Cache-Control' ).       "#EC NOTEXT
    response->delete_header_field( 'Expires' ).             "#EC NOTEXT
    response->delete_header_field( 'Pragma' ).              "#EC NOTEXT

    "Disable the compression. IE has problems here
    response->set_compression( if_http_entity=>co_compress_disabled ).

    navigation->response_complete( ).

IF_BSP_APPLICATION_EVENTS~ON_RESPONSE in Application-Class:

    "me->mv_offline_jar == xstring
      response->set_data( me->mv_offline_jar ).

     ...

      CONCATENATE 'attachment;' lv_file_name INTO lv_file_name SEPARATED BY space.
      response->set_header_field( name  = 'Content-Disposition'
                                  value = lv_file_name ).