How to open html attachment in new window?

My application has a feature to download different types of files(pdf, xls, html)
When user clicks on the respective links, a popup with Open, Save and Cancel option will come up.
Now the problem is when the attachment is html and user clicks Open, it opens in the main window.
I want it to be opened in a new window. It works fine for all other types of attachments.
Find below by code:
os = response.getOutputStream();
response.setHeader("Content-Disposition", "attachment;filename=document"+strDocExtn);
response.setContentType(strContentType);
response.setBufferSize(4096);
response.setContentLength(bByteArray.length);
os.write(bByteArray, 0, bByteArray.length);
os.flush();
os.close();strContentType and strDocExtn is dynamic
1. For html files it will come as text/html and .htm
2. For pdf files it will come as application/pdf and .pdf
similarly for other types..
Only html is giving me headache :(

target="_blank" did not work.
The attachment does not open directly. In other words, i do not use href.
The link is having an onclick event, which in turns calls the struts Action class and the response is returned as an attachment.
<a href="#" onclick="javascript:openAttachment(this.value)" value="123">And the value is unique id with which I can find to file to be downloaded.
Again the file I cannot access directly. I get it as byte array, which I put it in to my response.

Similar Messages

  • Open Mail attachment in new window.

    hi,
    i want to open a mail attachment using new window (in IE). here i am able to manage to create the new window and viewing the contents but the problem is the new window is opening before the 'open', 'save' or 'cancel' dialog box is coming.
    Currently in my JSP i am calling
    <a href="<%= sformUrl %> target="newwindow"><%= name %></a>
    this will open a window immediately and dialog box will come after that. if i select 'save', the new window get closed.
    i want the new window to open only if i select open.
    Can anybody help me?

    Renjith_Mathew wrote:
    thx for the reply. if i remove the target attribute, attachment will open in default applications like .txt in notepad etc. But here the problem is if try to open the html or unknown filetypes, browser will try to open it in current window and my current page over writes.Doesn´t happen here. Definately a client side setting.
    i dont want this becoz my web application is secured one and back/forward buttons wont work so my session will expire. What is it, "becoz"? Please write full words out. This forum is also visited by non-English-natives.
    So i want to open the html attachment and unknown file types in new window only if i am selecting 'open'. (new window should appear only if i am clicking 'open')That´s not possible with HTML. Best what you can do is to specify the target only when the file´s content type is HTML and live with it.

  • Open html file in new window it is opening in calling browser.

    Hi ,
    Am using adf 11.1.1.5 jdev.
    I have a pop in which pdf,html and rtf file extension are mentioned in drop down list . As i select htlm and fire command button .
    The generated html file is opening in the same browser which is replacing the calling page . I want to open in new window .
    thanks .

    Hi,
    iff you use ADF Faces, use a goLink with a target to _blank. If you don't use ADF Faces, provide more details to the question
    Frank

  • How to open Jasper report in New window (new Browser,new Tab)

    Hi,
    I'm Using oracle jdeveloper 11.1.1.4.0 fusion middleware for Jasper report. i want to open the Jasper report in new window
    In Application On click of CommandMenuItem(ExportToHTML)it opens the New Window,.While opnening this window i want to call a method (This method opens the jasper report in current browser)
    I Tried the afterPhase and beforePhase for this but doesnt work for me.while executing this using beforePhase I'm getting following Exception :
    Pls Help on this.Thanks in Advance......!!
    Java.lang.IllegalStateException: strict servlet API: cannot call getOutputStream() after getWriter()
    at weblogic.servlet.internal.ServletResponseImpl.getOutputStream(ServletResponseImpl.java:280)
    at javax.servlet.ServletResponseWrapper.getOutputStream(ServletResponseWrapper.java:112)
    at ReportsDisplayBean.exportHtmlReport(ReportsDisplayBean.java:272)Is any other way to do this ? :(
    Thanks.

    Hi,
    The view itself is a Web Part called an XSLT List View Web Part (XLV for short). This Web Part is stored on an ASPX page that is by default associated with a list or library on your site.
    I suggest you can check if the view page is valid, also, you can try to create another view, then redirect to the view page to see if there is xslt in the page.
    Here are some detailed articels for your reference:
    Create a custom list view using SharePoint Designer
    Using SharePoint Designer 2010 to Work with Web Parts
    How to: Customize the Rendering of a Field on a List View
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • How to open "Dispform.aspx" in new window or tab in SharePoint List item click.

    Hi,
    I have a SharePoint list.It has column name "Description" which is "Multiple lines of Text" and "<label for="onetidAppendOnly">Append Changes to Existing Text" is Yes.</label>
    Now the view showing the Description <label for="onetidAppendOnly"></label>column value as a "View Entries...". while click the view entries. It showing the records in same window. But
    instead of that i want to open the record in New tab / New window as Popup.
    Is it possible?
    Thanks & Regards
    Poomani Sankaran

    Hi,
    The view itself is a Web Part called an XSLT List View Web Part (XLV for short). This Web Part is stored on an ASPX page that is by default associated with a list or library on your site.
    I suggest you can check if the view page is valid, also, you can try to create another view, then redirect to the view page to see if there is xslt in the page.
    Here are some detailed articels for your reference:
    Create a custom list view using SharePoint Designer
    Using SharePoint Designer 2010 to Work with Web Parts
    How to: Customize the Rendering of a Field on a List View
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • How to open PDF file in new window as default

    I have .pdf documents into which I have inserted links to other .pdf documents using pdfEdit995
    (I am a 77-year-old pensioner recording monumental inscriptions, not very computer literate and not able to afford expensive applications !) 
    The links in the temp.ps file (which pdf995 creates first) look like :-
    [ /Rect [85 225 107 228]
    /Border [ 0 0 0 ]
    /Action /Launch /File (.\\Another Folder\\TARGET FILE.PDF)
    /Subtype /Link
    /ANN pdfmark
    The links work fine, but open in the same window, which is annoying as it is then neccessry to re-open the original document, scroll down to the required page and find the next link.
    pdf995 support say that perhaps Adobe reader can be set to open in a new window, but I want this to be the default when I circulate my file to interested people, so would prefer to modify the links.
    Can anyone help with a smple solution ? (I also believe in Santa Claus !)
    System: Vista; Reader X 10.1.0

    I don't know if you can change this in the PS file, but if you had Acrobat you could embed the following code into your file, that will make sure the links open in a new window. However, you should be aware that this code will change the preferences at the application level, which some people might not appreciate.
    The code is:
    app.openInPlace = false;

  • How to open URL iView in new window

    HI,
    We are not able to open the URL iView, which is assigned to page, in new window.
    We set the property "Launch in New Window" to Launch in Separate Window but no use.
    Please let us know the solution
    Thanks

    Hi Tatayya,
    Remove the delta-link that you have done for that iview to the page. Change the necessary settings on the iview level (skip this part if you have already done). Then re-"delta-link"the iview to the page and test if it open in a different window.
    Could also be your cache, so go ..navigate via Sys adm--> Navigation -> clear cache.
    Hope that helps.
    Ray

  • How to open form links in new window in Acrobat XI

    Does anyone know how to have a link within a form open a new instance of a browser?

    Answered through email:
    Hello,
    I don´t understand your problem. You have not tried the component mentioned in my replies, right? You have tried Launch URL component from WD Native. Because if you have, you would ask such a question. This component is a u201Cgroupu201D of a text field and a button. That means, that fits your problem completely IMHO. Place the component on your form layout, Set the presence of the text fox inside this Launch URL and you will see what address is being launch when clicked on the button.
    You said you have your address in the text field. So this is the same. Just change the source where the button takes the URL from or copy the value from your form into this one.
    Hope this helps.
    p.s.: looks like you have absolutely no exerience with JS coding.
    That means you need to read first and code later, right? Start here: http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_basics.pdf

  • How to open "edit locally " in new window

    Hi,
    tried creating a new command and adding parameter
    standalone=true,command=edit_locally.
    but this does not seem to work...
    Any suggestions...?
    Will reward points for helpful answers.
    Thanks
    Rocky

    Hi Rocky,
                    You have to configure Editing Service. Go to System Admin>Sys. config>Content Management>Utilities>Editing-->Local Editing.
                 Here in the Active Component drop down, you can select Activex (if your server is running on Windows, externally install Activex plug-in), If your server running on Unix select "Applet".
                 Think about awarding points if this helps you.
    Regards,
    Ramesh Kotagiri

  • How can I put OSX 10.7 on a new Macbook Air. Maverick no longer allows "open file in a new window" and I really miss it. At the Apple Store they told me it can't be added to the new OSX 10.10 so I  want to change the OSX on the new Macbook Air and it

    I have been using a 2012 Mac pro to do HD video editing. I bought a new portable Macbook Air only to find that Maverick no longer has "open files in a new window" which I use all the time in the very large folders of video clips and royalty-free music. I asked at the Apple Store how I could get this back on the Macbook Air and they said it couldn't be done so I thought I would re-format the HD and install 10.7 on it and was notified by the Macbook Air I can't put 10.7 on that computer. Apple use to give this as an option but now they have gone more to the attitude of "Do it our way or go to ****!" In anger I went out and bought a Dell Laptop and Pinnacle Studio 17 which I have been learning to use. I have been an Apple/Mac user since 1979 and would still rather do my video editing on a Mac. Is there any way that I can force the Macbook Air to let me load in OSX 10.7 where there is still the option to  "open files in a new window" or is there a way to add this to Maverick? The experts at the Madison, WI Couldn't give me any help on this.

    Choose Preferences from the Finder menu, click on the General tab, and uncheck the box to open folders in a new tab.
    (117195)

  • How do I make Firefox not open the homepage in new windows?

    Hi. I have a collection of 4 pages set to open every time I start Firefox. Whenever I need to open a new window, my 4 pages open again.
    I would like to have those 4 pages open only the first time I start the browser, because I never close them. Obviously I don't need them open again.
    How can I set it so that these 4 pages open the first time I start my browser, but only have a blank page open the next time I select "open new window."
    Even more ideal would be to have the choice to open my homepages or a blank page (in case for some reason they do get closed).
    Any solution that takes more than one extra step is one extra step too many. Otherwise, I'd simply just x out of three of my pages and change the URL of the 4th.
    I'm not entirely technically minded, so if yours is a technical solution, I thank you in advance for clearly laying out the steps one-by one.
    Cheers.

    One possibility would be to change how you open a new window. You can create a bookmark for Firefox's '''about:blank''' page and then, to open it in a new window, shift+click the bookmark.
    (To create it, right-click the Bookmarks Toolbar or Bookmarks Menu near where you want to add it and choose New Bookmark. Enter about:blank in the Location and any description you like in the Name, then click Add Bookmark.)
    But that might be difficult to remember or inconvenient, so the next thought would be to bookmark your 4 home pages as a group in a single folder on your Bookmarks Toolbar or Bookmarks Menu, as you prefer. If you ''middle-click'' that folder with the mouse scroll wheel, Firefox will open all of its pages in separate tabs in the same window. Does that still count as 1 step?
    (To create it, open a new window with your four tabs. Right-click any of the tabs and choose Bookmark All Tabs. This will create the new folder. Assuming it tests out, you can then change your Firefox home page to about:blank to display a blank page.)
    Are we getting closer?

  • When I choose to open a new tab from a website, such as facebook, it always opens it in a new window. How do I change this to just opening a new tab. I tried changing the tab settings but it did not work

    When I choose to open a new tab from a website, such as facebook, it always opens it in a new window. How do I change this to just opening a new tab. I tried changing the tab settings but it did not work. I did not have the problem until I started using firefox 4.

    It is probably a JavaScript link.
    You can probably force it where you want it with a keyboard shortcut
    either "Ctrl+click" or "Ctrl+Shift+click". see
    * Firefox and other Browser Keyboard Shortcuts (Comparison Table)<br>http://dmcritchie.mvps.org/firefox/keyboard.htm
    ''Did that work?''
    Some styles that provide a warning as to the type of link:
    * No Follow links, mouseover id of other links - userstyles.org<br>http://userstyles.org/styles/10987
    * Change cursor on some links with JS. - userstyles.org<br>http://userstyles.org/styles/233
    * Link Warning - Themes and Skins for Mozilla - userstyles.org<br>http://userstyles.org/styles/1301
    * Link warning (cursor hover) - various filetypes - userstyles.org<br>http://userstyles.org/styles/2538
    * Red hand cursor for .pdf links - userstyles.org<br>http://userstyles.org/styles/553

  • Simply put, I do not like like the new color coding "dots" and I do not like having to press the Command key before double clicking to open files in a new window. How hard would have been to include the old version of these two features?

    Simply put, I do not like like the new color coding "dots" and I do not like having to press the Command key before double clicking to open files in a new window. How hard would have been to include the old version of these two features?

    Apple - Mac OS X - Feedback

  • Since the latest update of 3.5.11, firefox opens links in a new window. it used to open links in a new tab. how can i fix that?

    since the latest update of 3.5.11, firefox opens links in a new window. it used to open links in a new tab. how can i fix that?

    The setting in "Tools > Options > Tabs" only works for links that would open in a new window.<br />
    That option allow you to divert such calls to a new tab.<br />
    For other links you either have to use a middle click or a Ctrl + left click or use the context menu.
    Tabberwocky: https://addons.mozilla.org/firefox/addon/14439

  • How To open a PDF in New Native Window in Air

    Hi All,
    I have a Air application.I want to open an pdf located in desktop in new native window.
    Thanks,
    Amol.

    There is no easy way to implement this. Its better to instruct users the shortcut to open the link in new window.
    --Cheers

Maybe you are looking for

  • Copying delivery time from 1st  (unconfirmed) schedule line to confirmed SL

    Hi Friends Long time since I visited our forum. During order creation or change,  by selecting all items and using 'Edit- fast change of- Delivery date' menu option one can set a delivery date and time for all the items. This info moves to schedule l

  • "Edit Personal Profile" - ESS Benefits

    Hi We have a requirement to open the "Edit Personal Profile" in ESS Benefits "New Hire Enrollment" (GAF) in place rather opening in external window. I changed the property in the launchpad ESS/MENU for the "Personal Profile" under Benefits Enrollment

  • Join cd tracks-greyed out

    I have searched this topic but the solutions don't seem to work or make sense. I have added 2 tracks to iTunes yesterday. They are random, but I labled them track 1 of 2 and track 2 of 2 so that I could join them. I don't see the sort by track in the

  • Possible to update photoshop elements 8 from windows to Mac platform?

    I currently own photoshop elements 8 for the windows platform.  I now need to use this on my MacBook.  Is it possible to use my current serial number to download the installation or do I need to repurchase the product?  It seems that later versions o

  • Vat amoutn posted wrongly

    hi gur's Customer invoice was posted  correctly by using the inr rupees. but the problem is In the middle of the invoice, an additional line is printed with the VAT calculated in USD. This is for the customer information, but it seems that the calcul