I created HTML5 web page that has an href link, this is linked to a file in the SQL server. I need a solution to open the linked file in a windows application like Image viewer, MS Word etc..or pop up an "Open with" window to choose the application I want to open the file. I want to implement this functionality in Javascript.
Related
I'm building a Django application and figured out how enable users to upload files (hosted by me)
Now I need to figure out how to let them click on a 'View file' button which opens the file in a default program. For example if it is a pdf, the file would open in Adobe Reader instead of in another tab. Or if it is a word doc it would open in Word (assuming that it was installed).
I know adding download links within the web app would be easy but is there a way to go a step further straight away open the file locally in an appropriate program.
In outlook, there is a feature “Home page address” of folder through which we can view web site within the outlook. If we set http://app.abctest.com in the Home page address of a folder, then when we click this folder in the outlook, it will display that page.
I have a very specific requirement for enabling end user to browse a web site (in my case, it basically lists some archived emails) within from the Outlook. This can be easily done by setting the “Home page address” in the properties windows of any Folder of Outlook.
The user will see the page within outlook. He can search the old archived emails in the page. Then, the users should be able to download that email and save it to a folder in outlook. End users are basically searching the emails within outlook and downloading them from the server directly to their outlook folder. When user click the download\save link or button, then the outlook’s “Select Folder” dialog should appear where user can select the destination folder. When user click “OK” button, that email should be save to the selected folder in the outlook.
Currently, I have very few solutions but not sure if they can achieve the goal.
Solution 1: ActiveXObject
I tried to use Outlook ActiveXObject in javascript (used the following code in my test page) but I got the following Script error Popup message.
“Automation server cannot create the object”.
Javascript code:
var objO = new ActiveXObject('Outlook.Application');
Solution 2: Javascript API for Office
I have started to read the MSDN documentation https://msdn.microsoft.com/en-us/library/office/fp142185.aspx but have not got any sample code.
Could someone please sheds some light on it? Or what would be the best solution for this? Or any alternative solution.
Prakash,
Only one instance of Outlook can be run at the same time. Try to use the GetObject function instead to get the running Outlook instance instead. See How to programmatically create an Outlook home folder page in the Outlook Today style for more information. However, home page scripting is limited and secured to prevent malicious software. I'd suggest developing an add-in which can add a custom form instead.
The second solution listed above is for Mail Apps. See How to: Create your first mail app for Outlook by using Visual Studio for more information.
When your script runs inside a folder home page, window.external.OutlookApplication will point to an instance off the Outlook.Application object - your should be able to use it without creating a new object.
My site is developed in SharePoint 2010.
In my Testing site,
Download File
when click on the above a tag, file opens directly in browswer(IE/Chrome/FireFox)
But same a tag is used in my Live site where it ask to save file(In IE) or gets downloaded(in Chrome).
For link on file use standard SharePoint download.aspx page.
Download File
Download.aspx will read the content of the file you send as the SourceUrl, and render it back to you on the HTTP response.
Hope that helps
I have a project developed with flex, in which reports are generated as SWF files. My requirement is that when I click an html button on my page, that SWF file should be opened with flash player installed within my system. How can I achieve the same if I want to do with javascript?
If you link directly to the SWF file the browser will attempt to open it. In order to be able to choose if you want to save/open the file in external application you need to alter the HTTP headers - which means some serverside scripting
I need full path to file when file is opened. For example user open file.txt but it will be opened with notepad or other. But how to register "hook" from NPAPI plugin to get path to file and prevent opening in other program?
An NPAPI plugin doesn't sound like it's at all the right technology for what you want to do. Plugins are for running native in the context of a specific web page, whereas it sounds like you just want a local application that's registered with the OS as the handler of certain file types.