Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

redirect to website from promise value fetch

fetch("http://example.com/", {
	method: 'POST',
	mode: 'cors',
	body: formData
})
.then(dataWrappedByPromise => dataWrappedByPromise.text())
.then(data => {
	//Redirect is the URL inside the text of the response promise
	window.location.replace(data);
})
 
PREVIOUS NEXT
Tagged: #redirect #website #promise #fetch
ADD COMMENT
Topic
Name
6+2 =