below are two links with download attribute.
clicking on both gives different result, why?
<a href="https://www.w3schools.com/images/myw3schoolsimage.jpg" download>
dnld
</a>
<br>
<a href="https://scontent.xx.fbcdn.net/v/t45.1600-4/28204217_6081249221877_6688541583534456832_n.png?oh=9262305ce4d55f669767f01c1be364b1&oe=5B06C1A9" download >Download</a>
w3schools link downloads the image where as the other one simply opens the image.
because the extension should be displayed at end of url
<a href="https://www.w3schools.com/images/myw3schoolsimage.jpg" download>
dnld
</a>
<br>
<a href="https://scontent.xx.fbcdn.net/v/t45.1600-4/28204217_6081249221877_6688541583534456832_n.png" download >Download</a>
Related
I'm learning HTML.
I've following code piece:
<a href="#B" id="specialClass" class="primary-btn icon-cart" data-one="#A" data-five="google.com" data-ten="#C" target="_blank">
<span id="pressButton">New Button</span>
</a>
When I press button based on slider and data-five gets triggered, I for some reason open in a new tab mywebsite.com/google.com instead of google.com.
What am I doing wrong?
If it is an address outside your web page you have to put the full path with https://google.es
<a target="_blank" href="https://google.es">Google</a>
I have a simple app that fetches images from Unsplash API. I would like users to click on the image, and download it and also maybe for the image to open in a new tab too.
The urls.regular is just a simple url like https://images.unsplash.com/photo-1543332164-6e82f355badc?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjE3OTUzOH0
After reading other issues on stackoverflow, I added "download" at the end of my a tag.
<div>
<a href={urls.regular} title={description} download>
<img
src={urls.regular}
/>
</a>
</div>
I have also tried the following in my a tag:
href={urls.regular}
target="_blank"
rel="noopener noreferrer"
download={urls.regular}
You should define onclick event for the a tag.
<a href={urls.regular} title={description} download onclick="onClick(urls.regular)">
function onClick(url) {
window.open(url, '_blank');
}
I've added a page link to a picture for my website, but it does not load the website because the link goes the directory therefore the webpages do not appear. My code is below:
<a href="www.w3schools.com">
<img src="Images/insta.png" alt="" style="width:7%; height:7%;">
</a>
When I click on the image it says file not found.
If you're linking to a page on an external site, you will need to provide the entire URL of the page in question, which includes the protocol. In this instance, that would be http://www.w3schools.com/.
By linking to www.w3schools.com, you are telling the browser to load that URL relative to the page you're linking from so, if this link were on a page located at http://domain.tld/page.html, clicking on it would attempt to load http://domain.tld/www.w3schools.com.
Add http:// OR https:// for your website link:
<a href="http://www.w3schools.com/">
<img src="Images/insta.png" alt="" style="width:7%; height:7%;">
</a>
<a href="http://www.w3schools.com" target="_blank">
<img src="Images/insta.png" alt="" style="width:7%; height:7%;">
</a>
Without the http:// your link will be something like: youraddress/www.w3schools.com
And pay attention if you image is in the correct folder called Images
I have a link on a webpage to open a new message in the default email service. The link opens and works except for the fact that the new window never has the focus. Is there a way to give it focus? I have included the link below.
<a href='mailto:soandso#email.com?Subject=hi' target='_top' id='emailEvents'>soandso#email.com</a>
New Page :
<a href='mailto:test#email.com?Subject=Test' target='_blank' id='emailEvents'>test#email.com </a>
This Page :
<a href='mailto:test#email.com?Subject=Test' target='_self' id='emailEvents'>test#email.com </a>
Use target="_blank"
<a href='mailto:soandso#email.com?Subject=hi' target='_blank' id='emailEvents'>soandso#email.com </a>
I placed this link inside a page to open a pdf, but it does not open. When I inspect the dom and click the highlighted href, it does open. Any suggestions?
<div class="document-wrapper">
<a alt="One Pager" class="document btn btn-link" href="/assets/asset_contents/5203/original/test.pdf?1405610951">One Pager</a>
</div>
try this:
for open the pdf in a new windows
<a target=\"_blank\" href="example.pdf" title="some title"></a>
if you want to put some linked image try this:
<a target=\"_blank\" href="example.pdf" title="some title"><img src="adobepdf.png" height="30" width="30"></a>
good luck