How to get the right URL before navigating the web page in the CHtmlView?
-
How to get the right URL before navigating the web page in the CHtmlView? Class CHTMLControl derived from CHtmlView, and over load the virtual function OnBeforeNavigate2. I Navigate an URL as following: CHTMLControl* pHTMLControl; … pHTMLControl->Navigate2(strURL); In the opened web page, there is a link whose html code is below: Free Search After clicking on this link in the html view, the following function is called void CHTMLControl::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel) But in this function, the value of lpszURL is "javascriptclickProcess("search");" How can I get the right URL of the next page before navigating it? Thanks
-
How to get the right URL before navigating the web page in the CHtmlView? Class CHTMLControl derived from CHtmlView, and over load the virtual function OnBeforeNavigate2. I Navigate an URL as following: CHTMLControl* pHTMLControl; … pHTMLControl->Navigate2(strURL); In the opened web page, there is a link whose html code is below: Free Search After clicking on this link in the html view, the following function is called void CHTMLControl::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel) But in this function, the value of lpszURL is "javascriptclickProcess("search");" How can I get the right URL of the next page before navigating it? Thanks
Hi superhandwolf, You can get the actual URL in the event "DocumentComplete", in your perticular case it will search for the given text and then gives you the actual URL for search result page... If you try to get the URL in OnBeforeNavigate2(...) using the 1 param i.e. IDisp. it would return you the current page's URL (i.e. page currently rendered ) "DocumentComplete" OR "DownloadComplete" can give you the URL... Cheers, Vishal -- modified at 6:19 Thursday 20th October, 2005