history.deleteRange()
Removes all visits to pages that the user made during the given time range. If this removes all visits made to a given page, then the page will be no longer appear in the browser history and history.onVisitRemoved
will fire for it.
This is an asynchronous function that returns a Promise
.
Syntax
let deletingRange = browser.history.deleteRange(
range
)
Parameters
-
range
-
object
. Specification of the time range for which to delete visits.
-
startTime
-
number
or string
or object
. A value indicating a date and time. This can be represented as: a Date
object, an ISO 8601 date string, or the number of milliseconds since the epoch. Specifies the start time for the range.
-
endTime
-
number
or string
or object
. A value indicating a date and time. This can be represented as: a Date
object, an ISO 8601 date string, or the number of milliseconds since the epoch. Specifies the end time for the range.
Return value
A Promise
will be fulfilled with no parameters when the range has been deleted.
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
deleteRange |
Yes |
79 |
49 |
? |
Yes |
No |
? |
? |
No |
? |
No |
? |
Examples
Delete all visits made in the last minute:
const MINUTE = 60 * 1000;
function oneMinuteAgo() {
return Date.now() - MINUTE;
}
browser.history.deleteRange({
startTime: oneMinuteAgo(),
endTime: Date.now()
});