B
B
bychok3002016-10-05 11:57:07
Java
bychok300, 2016-10-05 11:57:07

How to return HTML file as server response?

I can't share information on how to return an html file as a response from the server. Let's say the user clicks on the transition to a new page on the tag <a id = "newPage">newPage</a>. I need to indicate the path to this file in response, but I don’t understand how to do this, I write a backend in java

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
ruslanys, 2016-10-13
@ruslanys

If I understand correctly, the task is to prompt the client (browser) to download the file. I'm right? For this case, the simplest solution is to add the download
keyword to the a tag : But the best option is to return a Content-Disposition header in the response from the server :
Content-Disposition: attachment; filename=123.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question