Is it possible to redirect the user to whatever site they put in a text box? This is my HTML code:
<form method="post">
http://<input type="text" name="url">
<input type="submit" value="Submit">
</form>
Node.JS code:
if(request.method=="POST")
{
request.on('data', function (chunk) {
data = chunk.toString().replace("url=","")
console.log("DATA: "+data)
});
request.on('end', function(){
console.log("Done");
})
console.log("end")
response.writeHead(302, {'Location' : 'http://'+data})
}
the code prints out the data, done and then end sequentially. obviously it doesnt redirect the user. i already know how to redirect the user, but the code im using first tries to redirect the user, then reads what the user has written in.