Struct stdweb::web::Location
[−]
[src]
pub struct Location(_);
The Location
interface represents the location (URL) of the object it
is linked to. Changes done on it are reflected on the object it relates
to. Both the Document and Window
interface have such a linked Location
, accessible via Document::location
and Window::location respectively.
Note that all Location
methods can return a SecurityError
if the Location
object's
relevant Document
's origin is not same origin-domain with the entry settings object's origin.
See: https://html.spec.whatwg.org/#dom-location-href
Methods
impl Location
[src]
pub fn href(&self) -> Result<String, SecurityError>
[src]
The entire URL.
pub fn origin(&self) -> Result<String, SecurityError>
[src]
Returns a String
containing the Unicode serialization of the origin of the represented
URL, that is:
- For URL using the http or https, the scheme followed by
'://'
, followed by the domain, followed by':'
, followed by the port (the default port, 80 and 443 respectively, if explicitely specified); - For URL using
file: scheme
, the value is browser dependant. - For URL using the blob: scheme, the origin of the URL following blob:. E.g "blob:https://mozilla.org" will have "https://mozilla.org".
pub fn protocol(&self) -> Result<String, SecurityError>
[src]
Returns a String
representing the protocol scheme of the URL, including the final ':'.
Example: http:
pub fn host(&self) -> Result<String, SecurityError>
[src]
Returns a String
containing the host (i.e. hostname) and then, if the port of the
URL is nonempty, a ':', and the port of the URL.
Example: hitchhikers.com:4242
pub fn hostname(&self) -> Result<String, SecurityError>
[src]
pub fn port(&self) -> Result<String, SecurityError>
[src]
Returns a String
containing the port number or ""
if there is no port.
pub fn pathname(&self) -> Result<String, SecurityError>
[src]
Returns a String
containing an initial '/' followed by the path of the URL.
pub fn search(&self) -> Result<String, SecurityError>
[src]
Returns a String
which is a search string, also called a query string, that is a String
containing a '?' followed by the parameters of the URL.
These can then be further parsed via another library.
pub fn hash(&self) -> Result<String, SecurityError>
[src]
Returns a String
containing a '#' followed by the fragment
identifier of the URL. The fragment is not percent-decoded.
Trait Implementations
impl Clone for Location
[src]
fn clone(&self) -> Location
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Location
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl PartialEq for Location
[src]
fn eq(&self, __arg_0: &Location) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Location) -> bool
[src]
This method tests for !=
.
impl Eq for Location
[src]
impl InstanceOf for Location
[src]
fn instance_of(reference: &Reference) -> bool
[src]
Checks whenever a given Reference if of type Self
.
impl AsRef<Reference> for Location
[src]
impl ReferenceType for Location
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
Converts a given reference into a concrete reference-like wrapper. Doesn't do any type checking; highly unsafe to use! Read more
impl From<Location> for Reference
[src]
impl TryFrom<Location> for Reference
[src]
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: Location) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl TryFrom<Reference> for Location
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl<'_r> TryFrom<&'_r Reference> for Location
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl TryFrom<Value> for Location
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl<'_r> TryFrom<&'_r Value> for Location
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
Performs the conversion.