Making a link to an external site and downloading a file simultaneuosly - html

here's what I have so far but it downloads aff.php and then stops because there is no file in my FTP.
<button>Download</button>

One thing you could do, is remove the first href (href="https://www.abcgameservers.com/aff.php?aff=47") and replace it with onclick="window.open('https://www.abcgameservers.com/aff.php?aff=47')". That way you could have it open the page and download the file.

Related

html anchor to download file from another server

As I have searched, making a download link is like
<a href="image_url.png" download>download</a>
But the image must be in project directory. How to download from another server?
For example if I want to download django logo the code is supposed to be:
<a href="https://www.djangoproject.com/s/img/logo-django.42234b631760.svg" download>download</a>
but that's not working (it opens and shows the image in the current tab instead of downloading), but any file in my own server is being downloaded easily. What is the best way to do that? tnx
You simply need to put name of the file (how it should be saved) in download. Like this:
download
Edit:
Actually I was wrong. You can find the answer here. If you want to download SVG in regular way, like any other file, you need to use JavaScript, not just plain HTML tags. Or you can download it as PNG, but as I assume: that's not the point.
Sorry for mistake.
you put link in href on anchor tag:
download

How to create and edit .htaccess and see changes locally on a computer

Hello Stackoverflow Community,
I have built a website using HTML & CSS only, now it is live. Whenever I want to update it I just replace the files in File Manager in cPanel. Everything was perfect until I had to edit the .htaccess to remove the (.html) extensions from URLs. My problem is that href="about-us" without the .html don't work locally so I cant just replace the files in cPanel, now I have to remove .html from all links in all pages in File Manager. I have to do this every time I update the website.
Is there a way around that? like a local server that can understand links like href="http://example.com" or href="about-us"? any suggestions?
Thank you
Thanks to alex and Bogdan Stocia, I have used MAMP to run it locally and created .htaccess file to be able to view pages without .html extension and replaced <a> tag linking to my home page with href="/" instead of href="index".

How to open html file in go

I would like to open a html page in go. My project directory is home/usr/go/project/. And my html files are in /home/usr/go/project/static/.
I would like to open it as the program starts.
For actually opening a URL (or file, the browser must ofc reach it) you can use: https://github.com/0x434D53/openinbrowser

HTML PDF not opening

When I reference a .pdf in my webpage, the file doesn't open when I click on the link. I referenced the .pdf with the full path and the file is in the www folder.
When I hover over the link online, I can see that the link is to my .pdf on file but it doesn't open.
What am I doing wrong?
Thanks (HTML newbie)
Edit 1 - reference:
Filename
Edit 2:
I tried the local links extension and it still isn't opening. I also tried <a href="http://www.example.com/myfile.pdf"> and I get a 403 Forbidden error.
Modern browsers block links to file:// URLs from pages that aren't themselves on a file:// URL, and in the same directory tree.
This is a security feature. There are workarounds that you can install locally so it works on one specific computer. See this Mozillazine article.
Sorry - I don't have the rep to comment. But it looks like your ref structure could be wrong.
Try something like:
<a href="http://www.example.com/myfile.pdf">
UPDATE: Hmmm?
Have you tried just:
<a href="myfile.pdf">
Also, I found this which (while not directly relevant) has some discussions and links that may assist: How to set height on PDF file when linked to from HTML?
^^ Ignore that - it really is more related to how the pdf opens.
FURTHER:
I am assuming the pdf file name has no spaces in it. I also assume you have a local pdf viewer.
So I had a look at a random website which had a pdf link as an example. When clicked, it opened the pdf in a new tab. I am on chrome.
You may be able to use that to figure out what is wrong.
Here is the page: http://www.staff.uwa.edu.au/procedures/communications/media/uwanews
Looking at the pdf for the first listed file, this was their link:
Issue-10-December-2014 [PDF File, 2.0 MB]
It looks like path should be enough, but you might want to add the target="_blank" to open in a new tab.
Maybe also see this, which shows that users set how a pdf is opened - perhaps the settings on your end need to be set up: How to open link to pdf file in new tab using html
Anyway, I wish you the best. Post your answer when figure it all out.

Link to open PDF from folder

I have some PDF's sitting in a folder on my computer, is there a way to write a link to open them on to a webpage?
The main idea is when the site goes live the link will be used to download the pdfs from the folder, but obviously at a later stage the folder will be a temp folder on my website.
So at the moment i just want to open the pdfs from a link, and the final goal will be to have the links download them.
Can any one help me?
This is the file path to get to the pdf i want to link to.
C:\Users\Shaun\Documents\FormValue\CS1.pdf
How would i create the link?
If you want to have a link to a PDF, you just have to put the relative path to the file in the href attribute of an a tag. So let's say you had a folder called pdfs, with the file boom.pdf inside it, and folder called site sitting beside it, with the file site.html in it. Then all you'd have to do is put this link in the html file:
Link to a pdf
In most (all?) browsers now a days, that will open the PDF in a new tab. To download it you would right-click it and do the Save Link As thing. Just need to get the path in href right.
UPDATE
If you want to use the full path to the file, you need to prefix it with file://. Then you just put it in the href the same as with a regular link, ending up with something like:
Link to a pdf
This should work with your set up, but if the pdf and the html files are stored near each other, relative URLs are still a good option. A little bit of Google work should show you how to write those.
For each PDF just do what I talk about here.
<object height="950" data="sample-report.pdf" type="application/pdf" width="860">
<p>It appears you don't have a PDF plugin for this browser.
No biggie... you can <a href="sample-report.pdf">click here to
download the PDF file.</a>
</p>
</object>
It works with most browsers and it degrades nicely.
It sounds like youre asking if you can put a link on a web site to a PDF sitting on your computer. You can't. The files have to be either on another web site or on your site's server.
If you are using ASP.NET, you can have the link point to a handler that accepts a query string identifying the file, either by file name or a hash of the file. Then the handler can look in the folder for a file that matches the pattern, read the file as a byte array, and then write those bytes to HttpResponse.