Reputation: 339
I've this line of code. I'm trying to point my link on google for testing.
$content.="<a href='google.com' target=_blank>".$webSites['value']."</a>";
Instead of getting 'google.com' only, I'm getting as given below: (http://192.168.10.126/consumer/google.com).
Upvotes: 4
Views: 703
Reputation: 11
Just add http:// in front of google.com
current:
$content.="<a href='google.com' target=_blank>".$webSites['value']."</a>";
New:
$content.="<a href='http://google.com' target=_blank>".$webSites['value']."</a>";
Upvotes: 0
Reputation: 2849
$content.="<a href='http://google.com' target=_blank>".$webSites['value']."</a>";
This should fix it. The reason is that your browser does not know that you're linking to an external resource, thus thinking that you're linking to a relative path. With adding http:// you force your browser to think that it's an absolute path.
Upvotes: 4
Reputation: 15619
Add http://
in front of google.com
So your code looks like this:
$content.="<a href='http://google.com' target=_blank>".$webSites['value']."</a>";
Without http://
, your browser thinks that google.com
is an internal link. Adding the http://
protocol lets the browser know you want to link to an external site.
Upvotes: 5