Naked URL Link on Page opening to my site, not target site

I have a page on my site that has a link to a URL that users provide. If users provide a naked link like google.com, the URL link will open in a new tab, but appended to my site. For example mysite.com/google.com and not google.com.

Any way to resolve this?

EDIT: I think I misread this request. I believe you’re just looking to manipulate the string that the person provided to put it after your own domain? For that, you just use the bind (the power plug icon) to form a new string based on current hostname + “/” + the variable of the inputted domain.

Nope, the opposite. If it’s a naked url, it automatically put’s it after my domain. I do not want this.

I want google.com to open to https://www.google.com/

OK, so this is URL cleaning. I would check the URL for whether it starts with the appropriate scheme. In a simple implementation, apply the test in a “true-false split” in the workflow: if it starts with https://, redirect with that string, and if not, redirect to “https://” + your string

A couple of things.

  1. Why does it just append it to my domain?
  2. Seems kind of arduous if the “Link to” type I select is “URL”. I would expect it should open to that URL and not treat it as a page.

Link URL

Instead of using the “Link” section on the element settings, I tried to implement it through workflow. Use the “Navigate to” and specify that it’s an external link. I still get the same result.

Just to clarify, to resolve this, I have to make sure users are entering a fully formatted link, or format the URL myself at the time of redirection?

This is a very common situation in web development. statechange.ai is not a valid URL because it is missing a “scheme” - the part at the beginning with the https://. If instead you provide https://statechange.ai, that is treated as valid, just like the auto-highlighting just did in this post.

The vernacular idea of a URL is often that the hostname should be enough. It’s enough when we type into the browser bar. But that’s because the browser bar “FTFY” and if you click into it, you’ll see that it prepended the bit I just discussed. You need to apply that same service to provide the experience you want for your customers.

Alright, thanks for the information @raydeck. I just decided to enforce URL formatting on input by using

<input type="url" pattern="https?://.+">

1 Like