http - Open a new tab in a browser with the response to an ASP request -


it's bit complicated one... lets have listing of pdf files displayed in user's browser. each filename link pointing not file, asp page, say

<--a href="viewfile.asp?file=somefile.pdf">somefile.pdf</a>   

i want viewfile.asp fetch file (i've done bit ok) want file loaded browser if user had opened pdf file directly. , want open in new tab or browser window.

here's (simplified) viewfile.asp:

<% var fileid   = request.querystring ("file") ; var responsebody = mygetrequest (someurl + fileid) ;  if (myhttpresult == 200)     {      if (extractfileext (fileid).tolowercase = "pdf")         {         ??????  // return file contents in new browser tab         }         .... %> 

as daniel points out can control whether open in new window not new tab. if user has configured browser new windows should open in new tabs (like do) you're golden. if not open in new window. can't control tabs.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -