href

href tag download attribute - how to make it force download of externally hosted image?

白昼怎懂夜的黑 提交于 2021-02-08 13:57:20
问题 I want to make a <a href link which, when clicked, forces your browser to open a "Save As" dialogue. The use of the HTML5 download attribute should have this behavior on all modern browsers. When the target is an externally hosted image file, this does not work. The <a href link will navigate to the image instead of downloading it. (Tested using images hosted on Imgur and Tumblr) <a href="https://i.stack.imgur.com/440u9.png" download> <img src="https://i.stack.imgur.com/440u9.png" width="200"

about:blank#blocked on <a href=“file:///XXX”>Link</a> (Markdown Page)

夙愿已清 提交于 2021-02-07 11:54:34
问题 In a Markdown Page (Microsoft TFS Wiki) I try crate A tag for file link: <a href="file:///C:/temp\file.txt">file.txt</a> On click (Chrome), I got about:blank#blocked 回答1: It's not a Chrome-specific issue with protocol file: , Opera and Firefox display blank page too. When I want to browse HTML files on my localhost, I have to access them via protocol http: instead. For instance when I want to see C:\temp\file.html in Chrome, I will make a virtual directory in my local Apache host:

In a flask function which returns `send_file`, the code doesn't appear to run on subsequent requests, yet the file still downloads. Why?

北慕城南 提交于 2021-02-05 09:55:28
问题 I am using a Flask Code with the following route: @app.route('/download') def download_file(): path = "certificate.docx" print("certificate printed") print(os.getcwd()) return send_file(path, as_attachment=True) HTML Code: <p> <a href="{{ url_for('.download_file') }}">Download</a> </p> This piece of code is being executed to download a file named certificate.docx . The problem is that the print statements inside the function download_file() are not actually being executed, yet it still allows

extract href values containing keyword using XPath in python

百般思念 提交于 2021-01-28 10:33:06
问题 I know variants of this question have been asked a number of times but I've not been able to crack it and get what I want. I have a website which has a few tables in it. The table of interest contains a column where each row contains the word Text hyperlinked to a different page. Here is a specific example from the first row on the above linked page: <a href="_alexandria_RIC_VI_099b_K-AP.txt">Text</a> This is the general pattern: <a href="_something_something-blah-blah.txt">Text</a> Right now

extract href values containing keyword using XPath in python

假装没事ソ 提交于 2021-01-28 10:32:04
问题 I know variants of this question have been asked a number of times but I've not been able to crack it and get what I want. I have a website which has a few tables in it. The table of interest contains a column where each row contains the word Text hyperlinked to a different page. Here is a specific example from the first row on the above linked page: <a href="_alexandria_RIC_VI_099b_K-AP.txt">Text</a> This is the general pattern: <a href="_something_something-blah-blah.txt">Text</a> Right now

Javascript add ID to HTML href

你。 提交于 2021-01-27 07:37:32
问题 I have a livesearch script that i need to populate my html menu with information. i have a menu how looks something like this: <a href="?page=page&id=">Menu item</a> what i'm looking for is a piece of code that would do this to the link: <a href="?page=page&id=1">Menu item</a> i have a Javascript that pulls out value ID from a database table (livesearch), now i only need it to get into the href on the fly. Any suggestions? 回答1: function addPageIds(){ var links = document.getElementsByTagName(

Javascript add ID to HTML href

折月煮酒 提交于 2021-01-27 07:34:07
问题 I have a livesearch script that i need to populate my html menu with information. i have a menu how looks something like this: <a href="?page=page&id=">Menu item</a> what i'm looking for is a piece of code that would do this to the link: <a href="?page=page&id=1">Menu item</a> i have a Javascript that pulls out value ID from a database table (livesearch), now i only need it to get into the href on the fly. Any suggestions? 回答1: function addPageIds(){ var links = document.getElementsByTagName(

Getting the href attribute of an image with Javascript

我的梦境 提交于 2021-01-27 05:31:28
问题 New to Javascript, really need some help! Now I have an image in a HTML page, like this: <a class="p" href="http://www.abc.com"><img src="http://www.abc.com/logo.jpg" alt="" /></a> And get the image element by: var e.document.elementFromPoint(x,y); When I clicked on the image, I can get the src attribute or offset attributes successfully by: e.src or e.offsetHeight However, it returns NULL when I use: return e.href; So how can I get the correct href attribute (http://www.abc.com) ?? Thanks,

Getting the href attribute of an image with Javascript

左心房为你撑大大i 提交于 2021-01-27 05:28:58
问题 New to Javascript, really need some help! Now I have an image in a HTML page, like this: <a class="p" href="http://www.abc.com"><img src="http://www.abc.com/logo.jpg" alt="" /></a> And get the image element by: var e.document.elementFromPoint(x,y); When I clicked on the image, I can get the src attribute or offset attributes successfully by: e.src or e.offsetHeight However, it returns NULL when I use: return e.href; So how can I get the correct href attribute (http://www.abc.com) ?? Thanks,

How to read the contents of a href with javascript?

二次信任 提交于 2021-01-24 19:05:13
问题 I have the following html and am stumped as to how to read the contents of the href tag? <p class="xyz-title"> <a href="http://www.youtube.com/embed/xyz"> <span class="field-content">Title here</span> </a> </p> I tried document.getElementByClass('xyz-title')[0].innerHTML but that didn't work obviously. Thanks very much for pointing me in the right direction. 回答1: It is a syntax error. It is supposed to be getElementsByClassName. Use this instead: document.getElementsByClassName('xyz-title')[0