# Location

Examples of get the url within your application in Cypress, for a full reference of commands, go to docs.cypress.io

#### cy.hash()

To get the current URL hash, use the `cy.hash()` command.

    cy.hash().should('be.empty')

#### cy.location()

To get `window.location`, use the `cy.location()` command.

    cy.location().then(function(location){
      expect(location.hash).to.be.empty
      expect(location.href).to.eq('http://localhost:8080/commands/location')
      expect(location.host).to.eq('localhost:8080')
      expect(location.hostname).to.eq('localhost')
      expect(location.origin).to.eq('http://localhost:8080')
      expect(location.pathname).to.eq('/commands/location')
      expect(location.port).to.eq('8080')
      expect(location.protocol).to.eq('http:')
      expect(location.search).to.be.empty
    })

#### cy.url()

To get the current URL, use the `cy.url()` command.

    cy.url().should('eq', 'http://localhost:8080/commands/location')