Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7177545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:44:11+00:00 2026-05-28T16:44:11+00:00

I have not found a clear and obvious suggestion to emulate the browser’s ‘Back’

  • 0

I have not found a clear and obvious suggestion to emulate the browser’s ‘Back’ button in HtmlUnit. Have you done this? If so, how?

The best thing I’ve come up with is to execute javascript on the current page:

ScriptResult result = currentPage.executeJavaScript("javascript:window.history.back();");
currentPage = (HtmlPage)result.getNewPage();

Is there a suggested method to go back one page in history with htmlunit? What are the implications of going back with the above code? While I haven’t convinced myself that HtmlUnit actually does any accurate emulation of different browsers’ javascript interpretation, how close do I come to using HtmlUnit’s full capacity to emulate a browser’s back button using the above code? Is there a way to get a better emulation of a browser’s back button than this?

Also, I’ve noticed the History class in HtmlUnit, but it seems pretty worthless. Thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:44:12+00:00Added an answer on May 28, 2026 at 4:44 pm

    Probably I’m a bit late, but this might be useful for others too. You can go back in history by accessing the history of the WebWindow like this:

    webClient.getWebWindows().get(0).getHistory().back();
    

    There are other useful methods too. You can take a look at the API here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So far, I have not found a clear answer to this. I'd like to
I know this issue has been touched on here but I have not found
I've been trying to find a way to do this but, have not found
I have seen this question asked previously but can not find a clear explanation
I've searched here and online,. and have not found clear PHP examples for taking
I have searched and not found any clear answers to a problem im having.
I have not found any way to successfully set a screen resolution on my
I have searched but have not found my answer. Disclaimer: I am brand new
I have a question to which I have not found an answer. Let's say
I have searched far and wide on the Internet but have not found anything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.