>From the navigator.xul,
<textbox id="urlbar" class="plain" flex="1"
type="autocomplete" searchSessions="history"
timeout="50" maxrows="6" alwaysOpenPopup="true"
defaultSearchEngine="true" tabScrolling="true"
showCommentColumn="true"
tooltip="aTooltip" tooltiptext="&locationBar.tooltip;"
ontextcommand="return handleURLBarCommand(userAction);"
ontextrevert="return handleURLBarRevert();"
onfocus="URLBarFocusHandler(event);"
onblur="URLBarBlurHandler(event);">
<image id="page-proxy-button" allowevents="true"
ondraggesture="PageProxyDragGesture(event);"/>
<menupopup id="ubhist-popup"
class="autocomplete-history-popup"
popupalign="topleft" popupanchor="bottomleft"
onpopupshowing="createUBHistoryMenu(event.target);"
oncommand="executeUrlBarHistoryCommand(event.target);"/>
</textbox>
I can set the value of the URL location bar to particular URL using the
following code
nsCOMPtr<nsIDOMDocument> pDoc;
res = m_TopDomWin->GetDocument(getter_AddRefs(pDoc));
nsAutoString szTag;
szTag.AssignWithConversion("urlbar");
nsCOMPtr<nsIDOMElement> pUrlBar;
res = pDoc->GetElementById(szTag, getter_AddRefs(pUrlBar));
nsAutoString szValue;
szValue.AssignWithConversion("value");
res = pUrlBar->SetAttribute(szValue, sUrl);
However, I cannot navigate the browser to that location.
Is there anyway I can execute the ontextcommand?
Thanks
Jacob Wong