Click here to Skip to main content
16,023,339 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi All,

I am writing a small WPF application where I have used a web browser control.

I am getting some paragraph from db and putting the paragraph in the broser control by using webbrowser.NavigateTostring() method.


The problem is, in case the paragraph contains any URL, the web browser controls has to show that URL as a hyperlink.

Eg: Am navigating a paragraph as below.

WebBrowser.NavigateToString("I am regularly updating through http://www.codeproject.com. And It is very useful.");

Actual Result Is :

I am regularly updating through http://www.codeproject.com. And It is very useful.

Expected Result :

I am regularly updating through http://www.codeproject.com. And It is very useful.


Any help much appreciated.

Thanks in Advance.
Mydeen
Posted
Updated 19-May-11 19:56pm
v2

1 solution

Of course! There is no anchor ("a" element) which should show this is URL. Web browser does not read your mind. It does not try to guess where is the URL. More than that, your text is not HTML.

White valid HTML with valid anchor element to get the anchor you can click on and navigate.
Hope you will find HTML standard by yourself…

See:
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.navigatetostring.aspx[^], pay attention to this line "If the text parameter is not in valid HTML format, it will be displayed as plain text.".

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900