What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

File name change - date

sam73box

New member
Hello,
I am trying to create a pdf viewable webpage and it is working but I have a slight problem. 1 of the PDF files I am showing changes names each day. How do I create the web link that would change the file name? Todays file name would be "PMH Sep-21-2020", tomorrow will be "PMH Sep-22-2020". Thank you for the help!

;<!DOCTYPE html>
;<html>
; <head>
; <title>Title of the document</title>
; </head>
; <body>
; <h1>Good Morning!</h1>
; <iframe src="\\common\PMH Sep-21-2020.pdf#toolbar=0" width="100%"

;height="700px">
; </iframe>
; </body>
;</html>
 
function saveContent(fileContents, fileName)
{
var link = document.createElement('a');
link.download = fileName;
link.href = 'data:,' + fileContents;
link.click();
}

Try this & let me know if it was helpful.

Regards,
Tony.
 
Back
Top