question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Html)Page.getBaseUrl() not returning base URL

See original GitHub issue

getBaseUrl() does not seem to actually return the base URL anymore - in some cases at least.

The URL I loaded was something like this: https://www.example.org/details/a_b_60327_c-15651212_1;jsessionid=7132CE8CE959709FD76D745BA600BC9A?x=y&z=zz

But then

final String pdfUrl = "/a/b/c";
System.out.println(page.getBaseURL().toString()+ pdfUrl);

returns https://www.example.org/details/a_b_60327_c-15651212_1;jsessionid=7132CE8CE959709FD76D745BA600BC9A?x=y&z=zz/a/b/c

HtmlUnit 2.36.0

I circumvent this by checking whether it’s a relative URL or not and then using HtmlPage.getFullyQualifiedUrl().

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rbricommented, Jul 11, 2022

yeah thanks, throw it away - most probably obsolete.

Ok, will do.

I hope the same goes for you!

Yes outside the usual problems when getting older 😃

How are things going with HtmlUnit?

I think good - lot of work, some plans for version 3.0 but no time to do it as fast as i like

Guess you could always use some more helping hands?

Of course

Btw, does the GitHub sponsor thing go 100% straight into your pocket

Not really, but the sum i got every month is at least sufficient for the discussion with my wife if she ask what i’m doing here all the time Maybe i think different about that after my ‘Steuererklärung’

1reaction
rbricommented, Jul 9, 2022

Hi just found this old one - i like to close this. Please open a new one if you still think the current behavior is not correct.

BTW: Hope you are fine…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get base url with jquery or javascript? - Stack Overflow
But you can't say that the baseurl() of CodeIgniter(or php joomla) will return the same value, as it is possible to change the...
Read more >
3 Ways Of Get Base Url In Javascript - Get Absolute Path ...
get base url in javascript : We run time into a some difficult face issue while developing a fresh new website where We...
Read more >
base_url::Url - Rust - Docs.rs
Parse a string as an URL, with this URL as the base URL. Note: a trailing slash is significant. Without it, the last...
Read more >
RequireJS API
If there is no explicit config and data-main is not used, then the default baseUrl is the directory that contains the HTML page...
Read more >
visit | Cypress Documentation
visit() commands' pageLoadTimeout and baseUrl globally in the Cypress configuration. Yields. cy.visit() yields the window object after the page finishes loading ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found