Reputation: 901
I'm trying to get a simple piece of text displayed as a link. When it is rendered it looks correct eg: http://www.google.com, but the link redirects to my project with the link appended on the end: http://localhost:8050/brents-test-community/ru61pmlc7vry/groupplaymanager-display/h16wwislnsl/www.google.com, instead of just http://www.google.com.
This what i used:
var urlHtml = groupPlay.Url.link(groupPlay.Url);
var url = document.getElementById('GroupPlayInput_Url');
url.innerHTML = urlHtml;
The value of groupPlay.Url is a simply "www.google.com".
And this is the div:
<div style="padding-top: 5px;" id="@Html.IdFor(view => view.GroupPlayInput.Url)">
@if (Model.GroupPlayInput.Url.IsNotNullOrEmpty())
{
<a href="@Model.GroupPlayInput.Url" target="_blank">@Model.GroupPlayInput.Url</a>
}
</div>
Upvotes: 1
Views: 33
Reputation: 859
You can add http://
beside your url. This will indicate to the browser that the url is an absolute url (not a relative url).
Example : https://jsfiddle.net/nevgc71g/
Upvotes: 2