Click of button should open a new pdf or doc file in new page.

Click of button should open a new pdf or doc file in new page.

  
Hi All,

I have a button in my webscreen.When I clcik the button,it should open a new pdf or word doc in a new page.
I have placed the doc file under Resources folder of the espace.I have used javascript Window.Open("Resource.test.doc") but i am getting a 404 - File or directory not found error.May be I am referrring to incorrect URL in javascript function.Is there any other way to achieve this?

Thanks,
Prashanth
Hi Prashanth,

First thing to test, is your resource marked as to be deployed to the Targe directory:
 
If the above step was done...
Have you tested the link that you're passing to the javascript, manually?
If not, please do it, to confirm that the file exists in that path.
If you did, try open the file in the same page (troubleshoot) that you're indeed able to open the file with the click of a button.
Which browser are you using?

Cheers,

RG
Hi Prashanth
You con use a more easy aproach.
instead of using java scipt you can try using the download widget. with the save to disk property set as no

 
if the browser support this document type it will be opened on browser...
I'm not sure about the opening in a new tab / window...
but you can put this in at the end of the preparation flow in one screen and by doing this the screen will automatcly redirect to the file and you can use the extended properties of the link to use the "target _blank"

this will force a new tab to be opened.

Best regards
Carlos Rocha



Carlos Rocha wrote:
Hi Prashanth
You con use a more easy aproach.
instead of using java scipt you can try using the download widget. with the save to disk property set as no

 
if the browser support this document type it will be opened on browser...
I'm not sure about the opening in a new tab / window...
but you can put this in at the end of the preparation flow in one screen and by doing this the screen will automatcly redirect to the file and you can use the extended properties of the link to use the "target _blank"

this will force a new tab to be opened.

Best regards
Carlos Rocha


 
 Carlos Rocha wrote:
Hi Prashanth
You con use a more easy aproach.
instead of using java scipt you can try using the download widget. with the save to disk property set as no

 
if the browser support this document type it will be opened on browser...
I'm not sure about the opening in a new tab / window...
but you can put this in at the end of the preparation flow in one screen and by doing this the screen will automatcly redirect to the file and you can use the extended properties of the link to use the "target _blank"

this will force a new tab to be opened.

Best regards
Carlos Rocha

 
 Hi Carlos,

Thanks for response.I have tried the way you suggested.The document is getting saved to my disk instead of opening in new browser eventhough the property Save to Disk is set as:No.When I use chrome browser,the doc is getting saved but with IE I am able to see a new browser window opens up but no document.

Thanks,
Prashanth
 

 
Hi
I made some tests and I tried to open a Doc a Docx a picture(.png) and a pdf from file using the Chrome and IE browser
and the doc and docx any of them was able to open...
the image and the pdf worked well and opened in a new tab as expected

so my question is can't you replace the doc file by a pdf?

Best Regards
Carlos Rocha
Carlos Rocha wrote:
Hi
I made some tests and I tried to open a Doc a Docx a picture(.png) and a pdf from file using the Chrome and IE browser
and the doc and docx any of them was able to open...
the image and the pdf worked well and opened in a new tab as expected

so my question is can't you replace the doc file by a pdf?

Best Regards
Carlos Rocha
 Any sample OML by any change ...

I want to have the same, but can't get it to work in chrome.
I changed the download properties to "SaveDisk:no" 
Added extended properties to the link "target:_blank"

But it still opens the pdf in the same window ....
 
Hello Joop
I've created a test OML for you

Best Regards
Carlos Rocha
Ok, makes more sense now ... you do a funny trick by opening another window using javascript :-)
That window actually shows the binary (img/pdf/doc)
Hi Team,

Is it possible to open files  of type .xlsx and .docx in new tab ?
These files are saved in database.
i am able to open image and pdf files in new tab but .docx and .xlsx files are getting saved instead of opening in new tab.

Thanks in advance!

Regards,
Shweta