I'm using this html code to redirect to another URL when the page (www.dasinfobuch.de/links/Wizz) is invoked:
<head>
<meta http-equiv="refresh" content="0; URL=http://52.28.104.181:8080/Wizard/Wizz">
</head>
However, when I use a URL parameter such as
www.dasinfobuch.de/links/Wizz?template=test
the parameter is not passed on to the redirected page. Is there a way to accomplish this (preferably in plain HTML)? (I'm new to Web programming.)
This is not possible using only a meta element that mimics the non-standard Refresh
HTTP header field. Of course there are other ways.
If you’ve got something like a preprocessor, you can pass on the request to the HTML, like so:
<meta http-equiv="refresh"
content="0; URL=http://52.28.104.181:8080/Wizard/Wizz?template=<%
out.print(request.getParameter("template")) %>">
Another (client-side) way is to redirect using JavaScript:
document.location.href = 'http://52.28.104.181:8080/Wizard/Wizz' + document.location.search;
Note that this will carry over the entire query string, not just the template
parameter and its argument. If that’s a problem, it’s easy to get only the desired string from location.search
.