简体   繁体   中英

Redirecting to another web-page with a message [on hold]

I have a use case where I want to redirect to a external link(xxx) on click of a button. The UX which I want is while redirecting to a another webpage,it should show “You are being redirected to xxx site”.

“You are being redirected to xxx site”: This content is actually a html file.

Is there any way to achieve this?

Referring to your comment , try the following javascript code:

button = document.getElementById('BUTTONID')
button.onclick = function() {
  document.body.innerHTML = '<p>You're being redirected</p>';
  setTimeout(function() {
  window.location = "http://www.yoururl.com";
 }, 3000)
}

On button click, it will clear the page content, show You're being redirected text and redirect to yoururl after 3 seconds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM