Area protocol attribute

Definition and usage

protocol Attribute sets or returns href attribute value protocol part.

href The attribute specifies the destination of the link within the area.

A protocol is a standard that specifies how data is transmitted between computers.

See also:

JavaScript Reference Manual:location.protocol attribute

Example

Example 1

Return the URL protocol of the specific area in the image map:

var x = document.getElementById("venus").protocol;

Try it yourself

Example 2

Change the protocol part of the specific area in the image map:

document.getElementById("venus").protocol = "mailto:";

Try it yourself

Syntax

Return protocol attribute:

areaObject.protocol

Set protocol attribute:

areaObject.protocol = protocol

Attribute value

Value Description
protocol

URL protocol. Possible values:

  • file:
  • ftp:
  • http:
  • https:
  • mailto:

And so on...

Technical Details

Return Value: A string value representing the protocol part of the URL, including the colon (:].

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support