:right-sidebar: True SecurityOrigin =================================================================== .. currentmodule:: gi.repository.WebKit .. versionadded:: 2.16 .. class:: SecurityOrigin(**kwargs) :no-contents-entry: A security boundary for websites. :obj:`~gi.repository.WebKit.SecurityOrigin` is a representation of a security domain defined by websites. A security origin consists of a protocol, a hostname, and an optional port number. Resources with the same security origin can generally access each other for client-side scripting or database access. When comparing origins, beware that if both protocol and host are :const:`None`, the origins should not be treated as equal. Constructors ------------ .. rst-class:: interim-class .. class:: SecurityOrigin :no-index: .. classmethod:: new(protocol: str, host: str, port: int) -> ~gi.repository.WebKit.SecurityOrigin Create a new security origin from the provided protocol, host and port. .. versionadded:: 2.16 :param protocol: The protocol for the new origin :param host: The host for the new origin :param port: The port number for the new origin, or 0 to indicate the default port for ``protocol`` .. classmethod:: new_for_uri(uri: str) -> ~gi.repository.WebKit.SecurityOrigin Create a new security origin from the provided. Create a new security origin from the provided URI. Components of ``uri`` other than protocol, host, and port do not affect the created :obj:`~gi.repository.WebKit.SecurityOrigin`\. .. versionadded:: 2.16 :param uri: The URI for the new origin Methods ------- .. rst-class:: interim-class .. class:: SecurityOrigin :no-index: .. method:: get_host() -> str | None Gets the hostname of ``origin``\. It is reasonable for this to be :const:`None` if its protocol does not require a host component. .. versionadded:: 2.16 .. method:: get_port() -> int Gets the port of ``origin``\. This function will always return 0 if the port is the default port for the given protocol. For example, http://example.com has the same security origin as http://example.com:80, and this function will return 0 for a :obj:`~gi.repository.WebKit.SecurityOrigin` constructed from either URI. .. versionadded:: 2.16 .. method:: get_protocol() -> str | None Gets the protocol of ``origin``\. .. versionadded:: 2.16 .. method:: to_string() -> str | None Gets a string representation of ``origin``\. The string representation is a valid URI with only protocol, host, and port components, or :const:`None`. .. versionadded:: 2.16