• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Content-Disposition is replaces the parent window in IPAD

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I was trying to download a .csv file from my web application using Content-Disposition
here is my code

response.setContentType("application/octet-stream");
}

filename = filename.concat(downloadType);
response.setHeader("Content-Disposition","attachment; filename="+filename+";");
//response.setHeader("Content-Disposition","application/octet-stream; filename="+filename+";");


String source = (String)ivHttpRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")) {
source = Utils.decodeHtmlEntities(source);
}
byte [] byteArray;

if(source == null)
{
// use ivRequest instead
String source2 = (String)ivRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")){
source2 = Utils.decodeHtmlEntities(source2);
}
byteArray = source2.getBytes();
}
else
{
byteArray = source.getBytes();
}
ServletOutputStream out = response.getOutputStream();
out.write(byteArray);
out.close();
I'm able to download the file in all the browsers, But while using IPAD the content of the file replaces the existing window (Parent Window) without asking for Save or Open
Please let me know is there any special content type or anythinmg else i have to chanage..
THe problem i faced only with IPAD
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the iPad (not IPAD) has no user-accessible file system, what else would you expect it to do?
 
nishanth shanmugam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:As the iPad (not IPAD) has no user-accessible file system, what else would you expect it to do?



Thanks For Correcting Me.. In iPad i'm just trying to download a .csv file for a button action. But the csv file just replaaces the parent window. How can i force it to display a save or open promt before downloading it... (Or please tell me whether we can do it or not) or atleast i need it to opened in a new browser window
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, where would it download it to?
 
nishanth shanmugam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Again, where would it download it to?


If downloading is not possinble means, just opening it in a new window is enough for me.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the iPad even support more than 1 (browser) window at a time?
 
nishanth shanmugam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Does the iPad even support more than 1 (browser) window at a time?


New Tab is possible right?
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know, I don't own an iPhone, iPod or iPad (or any other device that starts with i). All I know is that some mobile devices (in which category I place iPads) have some limitations as far as multiple windows are concerned.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot "download" to an iPad and do anything else but display the file because there is no user-visible file system to write to.
 
nishanth shanmugam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You cannot "download" to an iPad and do anything else but display the file because there is no user-visible file system to write to.


ok.. but need to display it in a new tab (iPad can support new tabs right)
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That has nothing to do with the iPad, but with the mobile browser being used. You can try sending the request to a new window or tab via target="_blank" on a link, but the browser will do what it will with that.
 
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic