জাভাস্ক্রিপ্ট ব্যবহার করে অন্য ওয়েবপেজে রিডাইরেক্ট করার কোড নিচে দেওয়া হলো -
উদাহরণ
<!DOCTYPE html> <html> <head> <h1>Redirect to a Webpage Example</h1> <button class="redirectBtn">Redirect</button> <h2>Click the above button to Redirect to another Webpage</h2> <script> document .querySelector(".redirectBtn") .addEventListener("click", redirectFunction); function redirectFunction() { location.href("https://tutorialspoint.com/"); } </script> </body> </html>
আউটপুট
উপরের কোড নিচের আউটপুট দেবে -

'Redirect' বাটনে ক্লিক করলে নতুন সাইটে রিডাইরেক্ট হবে -
