window.history অবজেক্টটি ওয়েব ব্রাউজারের পূর্ববর্তী বা পরবর্তী পেজে যেতে ব্যবহৃত হয়। এতে ব্রাউজারের ইতিহাস থাকে এবং নিচের দুটি মেথড থাকে −
- history.back − পূর্ববর্তী URL-এ যান
- history.next − পরবর্তী URL-এ যান
উদাহরণ
জাভাস্ক্রিপ্টে window.history অবজেক্ট কীভাবে কাজ করে শিখতে নিচের কোডটি চালান −
<!DOCTYPE html> <html> <body> <script> function backPage() { window.history.back() } function nextPage() { window.history.next() } </script> <input type="button" value="Previous URL" onclick="backPage()"> <input type="button" value="Next URL" onclick="nextPage()"> </body> </html>