Open Select File Dialog on a predifined directory - javascript

For my project I need the users to be able to select a file from his PC.
Every user has his own path, and I must open the Select File Dialog ( Input type="file" ) on his path by default, so they can dirrectly pick the file without the need to search for the directory. By default when you open the Select File Dialog, it opens on a default location , example, Desktop / Downloads, and the next time you open it, on the last time you selected an item.
My question is, how can I archive this?
How can i specify the default Path?
It dosnt matter if you open the page from a Mac or Phone or whatever.
It dosnt need to be a html Input, it could be in JS, JQuery ...
I read that by security reasons you can't, and it seems legit but i found like for mozilla you can https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/Open_and_Save_Dialogs
Dunno if this could be archived on other navigators as Chrome or IE.
If anyone has archived it, could you pass me some URLs or code plz?
Thx in advance

No, you cannot do that. it's against the rules. Your "firefox" link refers to extensions, not pages. It would be a security issue to allow scripts to get any information about your computer's directory structure. If the open had an error callback for example, a script could guess user names in the background and try to open a folder for each of them until it no longer failed.

Related

change input HTML in chrome automatically

is it possible in chrome when if am in specific website if it have input with type password it automatically change it to text ?
the purpose of this is because I always want to see the password I am typing.
thanks for helping
I recommend downloading the extension tampermonkey that allows you to run JavaScript code on all the pages you want.
You can then create your own script to do what you want, or take one from GitHub:
like this one that seems to do what you want:
https://gist.github.com/LouCypher/1870154
to download the script just click on the raw button on gist after installing the extension, tampermonkey will automatically recognise the script and propose you to download it.

Unable to find javascript file in navigator in Chrome developer tools

How would I find this file if it didn't has breackpoint in it? Filename is axios-setToken.js and it is displayed in top tab, but not in navigator.
If you press Ctrl+P and start typing the filename, devtools should find the file and list it below; clicking it opens it. I use that often when files aren't listed in the navigation pane for whatever reason.
You see a message about this when there are no open editors:
Here for instance I've opened devtools on this SO page, opened a file (just to show that Ctrl+P works even when there's already an editor open), and typed the first three letters of "jQuery" since I know SO uses jQuery:
As you can see, it found jquery.min.js for me.
This is often handy even when files are listed in the navigator.

Disable toolbar in PDF Web View Element to disable Download and Print

My issue is that I have to deploy a local server (without internet), so I cannot use Google Doc Viewer in this case. All I want is to restrict the user from download or printing the document. I have tried hiding or removing the toolbar in JS but it is not working out.
You may be able to disable the toolbar somehow, but that isn't good enough to keep users from downloading or printing it anyway, and nothing you can do will be. If a person can see something, they can copy it, no matter what you try to do to stop them (and all trying will do is inconvenience legitimate users). Previous similar questions:
How to prevent downloading images and video files from my website?
disable downloading of image from a html page
https://graphicdesign.stackexchange.com/questions/39462/is-it-possible-to-prevent-download-of-images-when-designing-a-website
Although those talk about images, the exact same reasoning applies to PDFs.

How to hide "open with" option at the time of downloading file using javascript?

I have small requirement for downloading the file, here I would like to hide "open with" option and "Save" should be "Save As", could you please help me,
I'm assuming this is firefox relating. I don't think it's possible to change the options you're trying to change. However you can change the download action which might be useful to yourself. Please see below
This will not affect media embedded in a web page - only links to the files themselves.
Click the menu button and choose Options
Select the Applications panel.
The Applications panel will display. Select the type of file for which you want to change the default action.
The Action column will give you a drop-down menu, with options on action to take, whenever you click that type of file.
Always ask: will prompt you to select what action you want Firefox to take when you click on that type of file. This can be useful if Firefox is automatically saving a file type or is always opening it with a certain program and you want to be asked what to do.
Save File: will always save the file to your computer using the Downloads window, whenever you click that type of file.
Open the file with an application or plugin of your choosing.
Click Ok to close the options window after making changes]
Further reading here

Printing a Word document from IE without opening print dialog

I have a requirement where I need to print a specific word document when I click on a button in IE8/IE9. I tried to find a way using ExecWB and other methods but could not achieve my goal. Couple of constraints I have are as follows.
The word document is availble through URL and this URL is from a different site than the page where I am clicking the button to print (XSS considerations ?)
I need to directly print using default printer without popping up the print dialog.
Is this possible in anyway?
Impossible from within the context of HTML page, without a custom browser extension. Word document must open before it's printed (maybe not visually presented to the user upon opening, but MS Word or some other application that is capable of opening word docs must be installed on the client system. There is Office extension for IE, which can be used to open the document, but the user has to click on the print button to invoke the dialog. There's nothing that you can do from within javascript to accomplish that. I'm sure you could, if you wrote your own IE extension/plugin, but unless your users are corporate that must install it, nobody else will.
I hope I'm not lying to you.

Categories