diff --git a/dom/src/base/nsLocation.cpp b/dom/src/base/nsLocation.cpp index 86cb9271369..03f1dc42cdb 100644 --- a/dom/src/base/nsLocation.cpp +++ b/dom/src/base/nsLocation.cpp @@ -486,6 +486,13 @@ LocationImpl::GetHref(nsAString& aHref) NS_IMETHODIMP LocationImpl::SetHref(const nsAString& aHref) { + if (!aHref.IsEmpty() && aHref.First() == PRUnichar('#')) { + // Special-case anchor loads so that we don't stop content + // Note that SetHash (or more precisely nsIURL::SetRef) deals with + // the leading '#'. + return SetHash(aHref); + } + nsAutoString oldHref; nsresult rv = NS_OK;