using HTML how to open a file save dialog for download? - html

When I click a button I generate a file, the file name will be different each time, and the generated file should be downloaded to the user, with automatic save dialog.
Now I have created a hyperlink of it, on clicking it the dialog box opens, but the requirement is to have direct open of dialog without the hyperlink. Not sure what is missing.
I currently use <a href="filname" /a>
P.S.:
Web server is hosted on an embedded device with limited resources, and it supports basic HTML only. ( without .htaccess files )

If you need to download your content without user clicking on a link you create, create the link inside a hidden <div> and call the click() function on the created link.
<div id="hiddenDiv" hidden></div>
Execute this anywhere you want.
document.getElementById('hiddenDiv').innerHTML = '<a id="myLink" href="filename" >Save</a>';
document.getElementById("myLink").click();

Related

set a link to an external web page on which auto redirect should take place

If the external URL is typed in the browser address bar directly, a redirection to a pdf file happens.
i.e. if you enter https://www.the-external-site.com/information/ and press enter, the page is getting loaded and immediately after that a pdf opens. You can see the url changing to the pdf (i.e. https://www.the-external-site.com/fileadmin/the-information.pdf). Normally, only the URL with the "placeholder" is known to public, because the name and version of the pdf file can change over time.
Now, if I set a Link to this external URL like <a mat-raised-button color="primary" href="https://www.the-external-site.com/information/" target="_blank"> to the pdf </a> the first site gets loaded but the redirection to the pdf doesn't happen.
I tried to create a word file and entered the link there and clicked it. The redirection works here.
What am I missing?

How do I force an html file to open in the browser instead of downloading? (Classic Google Sites)

I'm using classic google sites and uploaded an html file. However, when I click on the link instead of opening directly on a new tab it tries to download it. So, how can I force that by clicking the link it opens directly in the browser?
Link location:
http://www.rodriguesloures.com/econometrics.html?attredirects=0&d=1
Code:
<div style="vertical-align:middle"><img alt="" src="https://sites.google.com/site/arloures/julia-language.png" style="vertical-align:middle" title="julia" width="25" height="25" border="0"> Applied Econometrics using Julia</div>
Thanks for you feedback!
Alexandre
You probably generated your html file with PANDOC and uploaded it to your site as page attachment (using Add file link). Google treats all attachments as files for download only.
What you can try to do is:
create a new page called econometrics for example
at the new page's EDIT pane click <html> button, Edit HTML popup window should be open now
Paste your entire HTML content into text area and hit update button
Now, all links to this page will open your HTML and not download it

How to save a webpage

I'm on a website which has multiple links, but when I click a new link, it just changes the screen, not the url. I'm trying to save the screen, but it is saving the original screen. I right click, save as, webpage, complete or webpage, html only (I've tried both), but the original screen shows when I open the file. Any way to get the screen that I want? The one in which I clicked the link.
I have to assume that the links are javascript or php connected and are echoing a new html code when you click the link. The echo once clicked should change the source output to your browser. Try to right click on the page after you clicked the link and select view source, or inspect element and see if you can find these links targets' or copy paste the renewed browser code to your browser into a notepad document then save the file as a .html save to your desktop and open. That should create the same screen you see when you click a link.
click the link, view the change you want to save. right click and select "view source" copy the source and paste into notepad. Save as a.html file and run with a browser. this should produce the visual are looking for then print.

Getting the generated sourcecode of a page in notepad

Is there any way of getting the source code of an HTML browser-page that is showing when i click inspect element(in chrome of firefox) and put it in a notepad(automatically) or maybe accessing it automatically somehow.
I do not want the original sourcecode but the one that is generated after all the javascripts have already run.
I would like to use the code afterwards in another web page and parse it...
later edit: i can actually click the html in the inspect element and click copy html but i need for a nother site to automatically acces this information because i will try reloading the site at regular intervals and need to constantly get the new html
With Firebug's HTML tab, you can right click on the element, and click "Copy HTML".
See also this post:
how to get fully computed HTML (instead of source HTML)?
press ctrl+u then it will display source code of html page then go to file menu and save it as html file in your system. then you can open it in html or another editor like netbeans /dreamviewer/notepad. I suggest you to open it in netbeans or dreamviewer will be better then open it in notped.
thanks.
You can use the web developer plugin for Firefox or Chrome. It gives you the generated source of a page.
In Opera , Right Click -> click on Inspect Element -> right click on <html> tag -> click on Edit Markup, from there you can copy the entire HTML code.
Edit -> In Oprea, right click on the page -> click on Source -> a new tab opens , in the menu bar of newly opened tab you have option 'Save' , from that option you can save the html code as .html , .txt.
Hope this helps you.

open pdf in internet-explorer-8

I have a file Life.pdf in the directory
\10.230.193.131\dev\Reports
From my window explorer I am able to browse the folder and I can open the file\10.230.193.131\dev\Reports\Life.pdf , manually.
Now in my html page I am having a link to open the file
"open
file"
When I point mouse on the link in the left bottom corner of the browser it is also written like
file://10.230.193.131/dev/Reports/Life.pdf
But on clicking on the link , the pdf file is not opening.
No warning is also displayed.
But when my click on the link from my friend's system, he is able to open the file.
What can I do to make it openable form my system ?
Note we both are in same network and both can access the file
\10.230.193.131\dev\Reports\Life.pdf using file browser/window explorer.
I just need to make it openable from ie 8 and above.
Please try: <a href="http://10.230.193.131/dev/reports/Life.xls" target="_blank">open file<a>
Thanks.