+static wxString StripProtocolAnchor(const wxString& location)
+{
+ wxString myloc(location.BeforeLast(wxT('#')));
+ if (myloc.IsEmpty()) myloc = location.AfterFirst(wxT(':'));
+ else myloc = myloc.AfterFirst(wxT(':'));
+
+ // fix malformed url:
+ if (myloc.Left(2) != wxT("//"))
+ {
+ if (myloc.GetChar(0) != wxT('/')) myloc = wxT("//") + myloc;
+ else myloc = wxT("/") + myloc;
+ }
+ if (myloc.Mid(2).Find(wxT('/')) == wxNOT_FOUND) myloc << wxT('/');