How can I open a PDF file in Microsoft Edge browser - file

I know that the easiest way to open a resource in Edge is by using the microsoft-edge: protocol handler.
I think this works for html files. For instance, you could run microsoft-edge:http://stackoverflow.com to open Stack Overflow in Edge.
But, what if I want to open a PDF file?
Can I run microsoft-edge:file:///C:/Desktop/sample.pdf ?
Looks like it's not working for me.
Thanks

I could reproduce the problem on my machine, it seems that you want to open a PDF file in Edge browser from another browser. As far as I know, Edge browser URL protocol no longer works for local files, only for http/https.
As a workaround, I suggest you could upload the local pdf file to the internet, such as OneDrive. Then, we could get the shared link and use it with the Edge URL protocol.
Sample code as below:
Link

Related

dart: How to save a file?

I need to save the file that is on my hard drive.
File address: /home/mk/proj1/1.txt
Program address: /home/mk/proj2/
I try to save:
new dom.AnchorElement(href: '/home/mk/proj1/1.txt')
..setAttribute("download", '1.txt')
..click();
Displays information about saving, but writes: Failed! No file.
How to save a file?
There is not really a way to save a file in the browser (except perhaps limited support for temporary files)
You can search for JavaScript solutions. They will be quite similar for Dart in the browser.
For example JavaScript: Create and save file
If you want to store a file on the client machine, you can provide a download link.
See also How to force a Download File prompt instead of displaying it in-browser with HTML?
To provide a download link for data that is available in the browser clients code instead of a server file, you can use a data url.
See also https://stackoverflow.com/a/29691487/217408

Is there anyway of opening html files directly at localhost on browser directly?

I know it sounds weird but what I want is to make some automation on machine. I want any html file would be opening from .../htdocs/* should open in browser with http://localhost/*. How would I achieve this ?
Problem is not that it is not loading but what I want is clicking on html file would be started on localhost//... path rather than c://... path.
I tried to search using batch job but I don't know how to code in it so I am trying to learn it though I'm not sure whether it serves my purpose or not.

How to get file download complete status using selenium web driver c#

I am writing a automation script using selenium web driver for downloading multiple files one by one from a web site in Mozilla fire fox. I have downloaded first file successfully and next time I need to wait for download to complete. Can anybody help how to identify an ongoing download is completed using c# selenium web driver.? Since I am not getting the download complete status, I am unable to continue downloading next file.
Assuming you are testing file downloading in Firefox as you mentioned. Here is an approach to achieve what you want.
Open new window/tab in Firefox and navigate to 'about:downloads' directly.
i.e. driver.Navigate().GoToUrl("about:downloads");
You will get the list of downloads (i.e. already downloaded files and the file which is being downloaded currently.)
You will have to switch between your site tab and downloads tab.
Now on downloads tab, looking at HTML, you can easily find out in progress download using state or status attributes.
For example, for the first file in the list, if state="0" and/or status
contains the text 'remaining', it means downloading is in progress
So you can wait till state becomes state = 1 and/or status does not contain >the text 'remaining'
Refer the attached screen shot.
The explanation I gave here looks very high level, but I am sure this approach will work. It is simple too.
Let me know if you have any queries on this.

How does the .gdoc format work?

If you work with Google Docs your first file format is .gdoc / .gsheet / .gwhatever
What I want to understand is, how this file format works. When you open a .gdoc you basically open the browser and go to a specific URL. So is a .gdoc just a .html-file with a changed file extension?
I would like to build something similiar: A rich-text-editor which saves the content in my own file format, that you can download and if you open the file, the browser opens and links to a specific URL.
BTW: I opened a .gsheet in a text editor and found this source code:
{"url": "https://docs.google.com/a/test.com/spreadsheet/ccc?key=01234567898765432123456789&usp=docslist_api", "resource_id": "spreadsheet:0A12345B678HJK9TZPL9078767"}
*Changed the URL a bit ;)
.gdoc and .gsheet files don't contain html, but JSON. These extensions are usually linked to the Google Drive application, which just reads the file and opens the URL with your standard browser.
If you're going to implement something like this yourself, you can go the same route: let the user install a program that handles your own files and start e.g. the browser.
Another way is to just use standard shortcuts; or use can use html files (maybe with another file extension if you link this extension to the standard browser) which just redirects to your target url.
in response to your comments:
to create a simple shortcut, you'll have to generate a file with the following content:
[InternetShortcut]
URL=your.url.com
and save it as YourFileName.YourExtension.url. Note that the "real" file-extension is .url. When saved to disk, windows explorer will usually hide the .url part (regardless of the Hide known file types setting). When the user starts this file, it will just open your.url.com. Chrome provides an API to create and save files client-side, but I don't know about other browsers. Probably you'll have to use a third-party library for creating the files (if you want to do this client-side).
Note this is a Windows-only solution. I don't know how you would handle this on Mac OS.

IE file download box get location

i am currently working on a issue where i need to get location of the file downloaded.First let me explain the scenario.
I placed a link in my page and when user clicks the link it shows file download dialog with open/save/cancel options in IE.Now when the user clicks on the save button and choose a location to save the file i need to get that file saved location using whatever options possible.
Thanks!
I do not think you can... at least not easy. This runs on the client, and for security reasons you can not acces the client's filesystem with javascript.
Maybe it is however possible using a flash or silverlight plugin, as the user can allow access from within these applications to the local filesystem. It might be very difficult tho...
The browser will not allow you to access information about the clients filesystem.

Resources