The mark() method creates a timestamp in the browser's performance entry buffer with the given name. The application defined timestamp can be retrieved by one of the Performance interface's getEntries*() methods (getEntries(), getEntriesByName() or getEntriesByType()).
The mark's performance entry will have the following property values:
entryType- set to "mark".name- set to the "name" given when the mark was created.startTime- set to thetimestampwhenmark()was called.duration- set to "0" (a mark has no duration).
If the name given to this method already exists in the PerformanceTiming interface, SyntaxError is thrown.
Syntax
performance.mark(name);
Arguments
- name
- A
DOMStringrepresenting the name of the mark.
Return value
- void
Example
The following example shows how mark() is used to create an application-defined peformance entry in the browser's performance entry buffer.
function create_mark(name) {
if (performance.mark === undefined) {
console.log("performance.mark Not supported");
return;
}
// Create the performance mark
performance.mark(name);
}
Specifications
| Specification | Status | Comment |
|---|---|---|
| User Timing Level 2 The definition of 'mark()' in that specification. |
Working Draft | Clarifies mark() processing model. |
| User Timing The definition of 'mark()' in that specification. |
Recommendation | Basic definition. |
Browser compatibility
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome Full support 43 | Edge Full support Yes | Firefox Full support 41 | IE Full support 10 | Opera Full support 33 | Safari Full support 11 | WebView Android Full support 46 | Chrome Android Full support 46 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 33 | Safari iOS Full support 11 | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown