A person adding an event with a URL who forgets to include the protocol (http/https) has it added for them, with a message that this was done

Created on 28 January 2023, almost 2 years ago

Problem/Motivation

A person putting a "URL" into their web browser's address bar has been able to skip the protocol (http or https) for a decade or more. News broadcasts providing a URL likewise start with the domain or subdomain. People do not ordinarily think of the protocol as a necessary part of a web address because for all practical purposes it is not— until they come to Drupal and add a link, and Drupal blocks submission of their content with the clientside, HTML validation: "Please enter a URL."

Steps to reproduce

  1. To the Drutopia Event or any content type, Drupal's core Link field with a configuration that allows external links.
  2. Create a piece of content And put in a URL minus the protocol, such as example.com.

Proposed resolution

Change the HTML input element to not be type="url" (unless there's some way around the clientside HTML validation).

On submission, if there is no protocol included, test the link with https:// prepended, giving at most a second to respond, and use http:// as what we prepend.

Provide a message, "We added the protocol (http://) to the link you provided to make a valid URL. An https protocol is preferable but we could not verify that SSL worked for the web address provided."

Or something less wordy. The latter part would only be stated if https did not work.

Oh, just realizing it would be much better to leave the input element as type URL and do all of this in JavaScript.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024