I have uploaded a doc file on my server and when i open this file by it's url then it's automatically downloaded but i want that this should open in a browser instead of downloading,please help me to resolve this issue.
If you want open your document inside Browser, you can try the following settings:
The setting that controls this behavior is located in Windows Explorer (not Internet Explorer) on the user's machine.
Open “Windows Explorer”.
Select Tools -> Folder Options... from the menu.
Go to the “File Types” tab.
In the “Registered file types list”, select the file you want to change the setting for (e.g. DOC).
Click the “Advanced” button to open the Edit File Type dialog.
There is a checkbox, Browse in same window, where you can specify whether the selected file type should be opened within the browser or launched in its host application when clicked on a web page.
For more information, please refer to: http://support.microsoft.com/?scid=kb;en-us;162059
Have you tried to use the page view web part and link to the document?
Also, does it have to be a word document? Could you try a different approach for the content, like using one of the page layouts or the content editor web part?
Related
I am new to Blazor and trying to show File Saveas Dialog as shown in following link on a button click.
Save as Image
The requirement is - upon clicking the Saveas button above Saveas dialog should be popped up where user can choose the destination of file and file name.
I have tried "enabling the setting to check the save location in the download settings of the browser" and it works. But we do not want to depend on the Browser settings.
Please add your thoughts on below..
Instead of depending on the browser settings is there any other way to show Saveas dialog?
Are there any open source Nuget packages available to help on this?
NOTE: I am using .NET 6.0 for building my application
Thanks in advance,
Bhargavi Gowri.
I also wanted to bring up a window to save a file in which the user could select a folder. Before that, the system automatically saved to the Downloads folder.
As I understood, there was no such possibility before, but now it is possible thanks to this api: https://caniuse.com/native-filesystem-api.
I found this solution in the answer to this question: https://stackoverflow.com/a/70001920/16740180.
It's worth noting that I use Blazor WebAssembly and not a Blazor Server. And I do not know if it will work for you.
Unfortunately, this doesn't work for mobile devices right now, but it works fine for windows. I hope this helps someone.
This isn't a Blazor thing. In web browsers, files are downloaded from links using <a> tag in HTML using the download attribute. Just create a link to your file:
<a href="path_to_file" download>Save</a>
Save
The path must be on the same server, but blob and data links will work as well.
If you do not suggest a name, the browser will use the original filename (possibly changed to remove symbols the OS doesn't allow in file paths).
https://caniuse.com/download
If you want your link to look like a button, then that's a different issue, and you can google or ask that.
I write HTML and CSS code in VS Code and for previewing it I need to open file explorer then files then double click them to open them in my default browser.
it takes too much time. is there any proper way for this?
I have tried one live extension called live server but the problem with it is we have to click the 'go live' button any time I want to refresh the code.
If the live server extension is the one by Ritwick Dey..
.. then then after clicking Go Live, it will open your page in the default browser and reload it automatically, every time you save your work.
in some cases, it is helpful to save the folder containing your HTML to a Workspace, in VS Code, especially if you are writing an app using the MVC modal and the HTML and CSS are in subfolders.
You can install an extension called open in browser.
After installation complete restart vscode and go to settings Ctrl + ,. Search for Open-in-browser setting and set your default browser as you can see below:
Then whenever you edit a html file, you can use shortcut Alt + B to open this file in browser.
I want to use the html href attribute as a hyperlink to present a local html file, located on my hard rive.I have the following code, and I'm using the Chrome browser:
List: Specified
The "Local File Links" extension is enabled.
I've also tried:
(a) href="file:///F:......\nameOfLocalFile.html">Specified
(b) List: Specified
It doesn't work and the files are not opened.
Is there a new way today (11/2019) in html to access other files on my hard drive in Chrome (and in other browsers, possibly). Is there a certain extension in Chrome I am missing or a certain keyword in html for achieving this?
I am running Windows 10 and Using Chrome as default browser.
You have done a simple mistake.
Try to change your \ to /.
Click
Your problem will be sorted out
Is there a way for an HTML file or other format that when clicked, will open the default browser and navigate to a specified http:// web page, NOT a local file:// ?
<script>
location.href = 'www.someUrl.com'
</script>
Just create an html file that contains something like the above. When you click it you will be redirected.
At least for an HTML file, no. When you click on an HTML file, your computer will open it in your default web browser, and the URL at the top will will be a file:// as that's the location of your file. You can, however, include some JavaScript to redirect people.
<script>window.location = "https://www.google.com";</script>
That way people will open the local file, but they will be automatically redirected to Google.
Yes, a shortcut.
Create shotcut and type your browser application url and add link.
Example like this:
"C:\Program Files\Firefox\firefox.exe" "http://www.google.com"
Do you mean if there is a way to set your HTML files to a default web browser, so that when you double-click them, they'll open up in....lets say for example (chrome.exe, firefox, opera, etc etc...)? If so, I recommend you right click the HTML file and navigate to "open with", and choose the web browsing program you want to use.
If you really want to take the easy route. Download notepand++ text editor(notepad-plus-plus.org).
Here's a picture of how to run HTML file in notepad++ in the browser:
http://i.stack.imgur.com/Yuynt.png
Download
If I click Download button, this target blank is opening a new window.
But I need it to prompt a dialog for saving this file. How can I achieve this?
This is something that you cannot absolutely control with HTML itself.
If the user is having a browser with PDF reading capabilities (or a plugin) and the corresponding settings to open PDF files in-browser, the PDF will open like that.
The PDF opens in a new tab simple because of your target="_blank", which has nothing to do with a download prompt.
If you are using HTML5 you can use the download attribute:
Download
If you have a back-end service which you can control or you feel like fiddling with your Web Server, you can always look for setting the right Content-Disposition. See this SO question for some nice discussion on Content-Disposition.