Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Exporting PDF in Safari opens empty browser window that doesn't close

    In Safari, when exporting to PDF via the RPCManager.exportContent() function, an empty browser window is opened and not closed. This page ultimately ends up covering the main browser window with the app in it, which can be confusing to some users. This behavior doesn't happen in Firefox or Chrome. As part of exporting the PDF, a browser tab is opened and then closed in those browsers.

    Here is some sample code that you can run to create the problem in Safari.

    Code:
    package com.smartgwt.sample.client;
    
    import java.util.Date;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.rpc.RPCManager;
    import com.smartgwt.client.types.ExportDisplay;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.FloatItem;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class PrintTextItemIssue implements EntryPoint {
    
    	public void onModuleLoad() {
    
    		final VLayout example = new VLayout();		
    		
    		IButton button = new IButton("Print", new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				// Now print it
    				DSRequest requestProperties = new DSRequest();
    				requestProperties.setExportFilename("chris" + (new Date()).getTime());
    				requestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
    				requestProperties.setContentType("application/pdf");
    				requestProperties.setDownloadResult(true);
    				RPCManager.exportContent(example, requestProperties);
    			}
    		});
    		example.addMember(button);
    		
    		DynamicForm form = new DynamicForm();
    		
    		FloatItem f1 = new FloatItem("f1", "f1");
    		FloatItem f2 = new FloatItem("f2", "f2");
    		FloatItem f3 = new FloatItem("f3", "f3");
    		
    		form.setFields(f1, f2, f3);
    		
    		example.addMember(form);
    
    		example.draw();
    	}
    }
    Can this behavior be fixed/changed in Safari? The extra web page is very intrusive.

    I'm using Safari 5.1.7 on MACOSX 10.6.8.

    SmartClient Version: SNAPSHOT_v8.3d_2012-09-14/Enterprise Deployment (built 2012-09-14)

    #2
    It's unfortunate, but we don't actually have control over this behavior. On the bright side, it certainly seems like a bug in Safari (the server is explicitly telling the browser this is a download, so there's no reason to keep the window/tab open) so they may fix it in the future.

    Comment


      #3
      I was afraid that might be the case. Thanks for letting me know.

      Cheers,
      Chris

      Comment

      Working...
      X