Analyzing javascript functions

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I want to convert javascript functions Relative URL to absolute URL.

I have all the javascript urls extracted from a web page this being done from the HTML DOM of web page and the page is being browsed in webbrowser control in my c# project.

I want to get the absolute url of a javascript function. Presently i am simulating the onclick event of Browser through MSHTML and capturing the url in beforenavigate event but that ends up in a chaos as it sends reuqest for navigation and takes up time. This scenario is quite cumbersome in cases
where there are a no. of javascript functions and for each a request is being sent.

One possible way is to stop the browsing once i have the url, however that doesnt seems to be a good way to solve the problem.

some examples
javascript:LinkToPage('/index.asp')

Absolute Path:- http://abc.com/index.asp


--
some code
---
for(int j = 0; j < anchors.length; ++ j)
{
link = (mshtml.IHTMLAnchorElement)anchors.item(j, null);
if (link.href.ToLower().StartsWith("javascript"))
{
ele = (mshtml.IHTMLElement)link;
if (cnt == count)
{
currentEle = ele;
currentDoc = doc;
found = true;
break;
}
---
more code
---
currentEle.Click()
}


Now capturing the url in before navigate event

private void BeforeNav(object sender, NavigateEventArgs arg)
{
try
{
string Url = arg.Url
----
----

Any suggestions!

--------------------------------
From: Shajee

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>1ZpHjJGxmEWHqTUgjRLUVA==</Id>
.