Reputation: 15
There is now a solution to this problem, here is the code that worked for me:
chrome.LoadHtml(@"<html>
<center><h1>New tab</h1></center>
<center><a href=""https://youtube.com"">YouTube</a>, </center>
<center><a href=""https://google.com"">Google</a></center>
<center><a href=""https://github.com"">Github</a></center>
</html>");
How do you add hyperlinks in CefSharp.LoadHtml? I've been getting Syntax error, ',' expected in Visual Studio 2017, and after adding commas the link such as youtube.com, still not working so I tried https:// and to my surprise, it made everything after that commented. I've done some research and it seems that no one else is having this problem at the moment.
I'm new to CefSharp and read through some tutorials on the internet. It's for a newtab page I'm trying to do.
chrome.LoadHtml("<html><center><h1>New tab</h1></center><center><a href="youtube.com">YouTube</a>, </center><center><a href="google.com">Google</a></center><center><a href="github.com">Github</a></center></html>");
Upvotes: 1
Views: 87
Reputation: 180788
Try something like this:
chrome.LoadHtml(
@"<html>
<center><h1>New tab</h1></center>
<center><a href=""https://youtube.com"">YouTube</a></center>
<center><a href=""https://google.com"">Google</a></center>
<center><a href=""https://github.com"">Github</a></center>
</html>");
It uses a Verbatim String Literal, which allows you to use multi-line markup, as nature intended. The double-double quotes are VSL's way to escape double-quotes.
Upvotes: 2