SafariExtensionSecureSettings Class Reference

Inherits from
Technology area
Safari Extensions
Availability
Available in Safari 5.0 and later.

Overview

The SafariExtensionSecureSettings class provides a place for your extension to securely store settings that should persist between sessions. You interact with it in exactly the same way as you interact with the SafariExtensionSettings class.

Tasks

Reading and Writing Settings

Removing Settings

Methods

clear

Removes all key-value pairs.

void clear (void);
Discussion

If there is nothing to remove, this method does nothing.

On success, this method dispatches a SafariExtensionSettingsChangeEvent event describing the change.

Availability
  • Available in Safari 5.0 and later.

getItem

Returns the current value of a key.

any getItem (in DOMString key);
Parameters
key

The key whose value is being returned.

Return Value

If the key exists, its current value; otherwise, null.

Availability
  • Available in Safari 5.0 and later.

removeItem

Removes a key.

void removeItem (in DOMString key);
Parameters
key

The key being removed.

Discussion

If there is no value with the given key, this method does nothing.

On success, this method dispatches a SafariExtensionSettingsChangeEvent event describing the change.

Availability
  • Available in Safari 5.0 and later.

setItem

Sets the value of a key.

void setItem (in DOMString key, in any value);
Parameters
key

The key whose value is being set.

value

The value being set.

Discussion

The behavior of this method is undefined if value cannot be serialized to a JSON value.

On success, this method dispatches a SafariExtensionSettingsChangeEvent event describing the change.

Availability
  • Available in Safari 5.0 and later.