User submitted links don't always have http:// so aren't opening properly, what can I do?

Hi all,

I have member profiles on my website, and they can upload a portfolio link.

However, if their portfolio link doesn’t contain http:// protocol, it won’t open properly.

E.g. mywebsite.com/member/member-name/theirwebsite.com (which is a 404 error) instead of directly opening https://www.theirwebsite.com

Is there anything I can do, other than make it clearer to the user, to fix this?

Thanks!

You can probably use some Javascript to automatically detect if the link contains the protocol and add it in if it doesn’t (here’s a stack overflow article covering the topic), but keep in mind the link mentions that the solution isn’t perfect and doesn’t detect variations with casing.

That said, I’d recommend including some helper text to encourage proper links as a backup just in case.