I am creating custom form in jQuery and HTML5. I am using rest api for getting data. I am fetching attachment also and generating dynamic string with HTML code with jQuery.

Every thing goes fine it displaying link, now issue when I click the link it download the file. I wanted to make link like SharePoint Attachment link where when click on the link which opens the file inside the browser.

How can we do that !!


If it is an external application than you can try below code to open document in new Browser tab.

var win = window.open('http://stackoverflow.com/', '_blank');

Above code is also works fine within SharePoint as it is only a JS code.

  • Links are opening from outlook – Milind Jun 4 '16 at 7:16
  • So you need JS code & i provided you the same. – Hardik Jun 7 '16 at 11:44

To open the link inside browser has many scenarios, if the browser is google chrome, it automatically opens the PDF file within the browser, while I.E. pops up to download the file. If you have office web apps installed within the FARM all the links will be opened in browser only.

  • Actually when we open List attachment it opens inside the browser but links which I make they download. Why is it so !! – Milind Jun 4 '16 at 7:19
  • Go to browsers developer settings, open network tab, on it. Trace the network http request by clicking on the download link, check if that does not match with clients call. I think there is a different path on there machine. – Farshid Mahdavipour Jun 4 '16 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.