Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

CGI::HtmlExtension#base

base(href = "") { || ... }

Generate a Document Base URI element as a String.

href can either by a string, giving the base URL for the HREF attribute, or it can be a has of the element’s attributes.

The passed-in no-argument block is ignored.

Example
base("http://www.example.com/cgi")
  # => "<BASE HREF=\"http://www.example.com/cgi\">"
See also #a #blockquote #caption also in 3.3 · 3.2 · 3.1 · 3.0