I’m new to HTML and javascript. So basically I have 2 HTML files
a.html
<html>
<head>
<!-- Some Stuff-->
</head>
<body>
<script>
</script>
<!--In this part there is going to be a url of pdf.
I want that URL to be transferred to b.html
so that the same pdf could be shown.-->
</body>
</html>
b.html
<html>
<!-- Code goes here-->
</html>
Comments
Comment posted by mplungjan
Transferred when? Javascript is event driven. What event will show page b and why show it with the same PDF? You can pass data in the URL, in local/sessionStorage or cookies (if same origin)
Comment posted by sortedcord
I forgot. The event will take place when the user clicks on b.html link on the a.html page
Comment posted by Emiel Zuurbier
Hey @MinemanDev, welcome to SO. Your question is very vague at the moment and needs more specificity to determine what kind of solution you are looking for. For example: describe your outcome. Please modify your answer so that others can help you better.
Comment posted by mplungjan
Where is the link to page b and why do you want to show the same pdf on page b and why do you have to pass the pdf information to page b, does it not know it?
Comment posted by sessionStorage
Are the pages on the same domain? If so, use
Comment posted by sortedcord
Can you pls explain. What are the last 3 var. for?
Comment posted by mplungjan
Don’t accept an answer until it work as you expect. I do not see why this is a valid answer to your question. @AmiteshSingh please explain the code and format it proper