Tabnine Logo For Javascript
Window.location
Code IndexAdd Tabnine to your IDE (free)

How to use
location
function
in
Window

Best JavaScript code snippets using builtins.Window.location(Showing top 15 results out of 45,099)

origin: Automattic/wp-calypso

originUrl() {
    return (
      window.location.protocol +
      '//' +
      window.location.hostname +
      ( window.location.port ? ':' + window.location.port : '' )
    );
  }
origin: cube-js/cube.js

async componentDidMount() {
  const res = await fetch('/playground/context');
  const result = await res.json();
  this.setState({
   cubejsToken: result.cubejsToken,
   apiUrl:
    result.apiUrl || window.location.href.split('#')[0].replace(/\/$/, ''),
  });
 }
origin: codeceptjs/CodeceptJS

/**
  * Gets page URL including hash.
  */
 async _getPageUrl() {
  return this.executeScript(() => window.location.href);
 }
origin: i5ting/nodejs-fullstack

function() {
  var multiplex = Reveal.getConfig().multiplex;
  var socketId = multiplex.id;
  var socket = io.connect(multiplex.url);

  socket.on(multiplex.id, function(data) {
    // ignore data from sockets that aren't ours
    if (data.socketId !== socketId) { return; }
    if( window.location.host === 'localhost:1947' ) return;

    Reveal.slide(data.indexh, data.indexv, data.indexf, 'remote');
  });
}()
origin: iaincollins/nextjs-starter

async handleSignoutSubmit(event) {
   event.preventDefault()
      // Save current URL so user is redirected back here after signing out
   const cookies = new Cookies()
   cookies.set('redirect_url', window.location.pathname, { path: '/' })

   await NextAuth.signout()
   Router.push('/')
  }
origin: yioMe/nodejs_wx_aipay_api

// Content-Scroll on Navigation click.
  $('.sidenav').find('a').on('click', function(e) {
    e.preventDefault();
    var id = $(this).attr('href');
    if ($(id).length > 0)
      $('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400);
    window.location.hash = $(this).attr('href');
  });
origin: hilongjw/vue-zhihu-daily

self.$http.get(window.location.origin + '/imagebox?type=rev-64&data=' + data)
    .then(response => {
      if (response.data.code === 200) {
        IMG_MAP.set(uri, response.data.data.url)
        callback(response.data.data.url)
      } else {
        console.log(response.data.message)
      }
    })
    .catch(err => {
      console.log(err)
    })
origin: strapi/strapi

(() => {
 if (window.location.port === '4000') {
  return 'http://localhost:4000/admin';
 }

 // Relative URL (ex: /dashboard)
 if (process.env.REMOTE_URL[0] === '/') {
  return (window.location.origin + process.env.REMOTE_URL).replace(/\/$/, '');
 }

 return process.env.REMOTE_URL.replace(/\/$/, '');
})()
origin: hilongjw/vue-zhihu-daily

hotClient.subscribe(function (event) {
 if (event.action === 'reload') {
  window.location.reload()
 }
})
origin: strapi/strapi

(() => {
 // Relative URL (ex: /dashboard)
 if (REMOTE_URL[0] === '/') {
  return (window.location.origin + REMOTE_URL).replace(/\/$/, '');
 }

 return REMOTE_URL.replace(/\/$/, '');
})()
origin: cube-js/cube.js

async loadContext() {
  const res = await fetch('/playground/context');
  const result = await res.json();
  return {
   cubejsToken: result.cubejsToken,
   apiUrl:
    result.apiUrl || window.location.href.split('#')[0].replace(/\/$/, ''),
  };
 }
origin: i5ting/nodejs-fullstack

/**
   * Checks if this instance is being used to print a PDF.
   */
  function isPrintingPDF() {

    return ( /print-pdf/gi ).test( window.location.search );

  }
origin: Flood-UI/flood

handleLogoutClick() {
  AuthActions.logout().then(() => {
   window.location.reload();
  });
 }
origin: strapi/strapi

(() => {
 if (window.location.port === '4000') {
  return 'http://localhost:4000/admin';
 }

 // Relative URL (ex: /dashboard)
 if (process.env.REMOTE_URL[0] === '/') {
  return (window.location.origin + process.env.REMOTE_URL).replace(/\/$/, '');
 }

 return process.env.REMOTE_URL.replace(/\/$/, '');
})()
origin: Automattic/wp-calypso

function getOriginUrl() {
  return (
    window.location.protocol +
    '//' +
    window.location.hostname +
    ( window.location.port ? ':' + window.location.port : '' )
  );
}
builtins(MDN)Windowlocation

Most used builtins functions

  • Console.log
  • Console.error
  • Promise.then
    Attaches callbacks for the resolution and/or rejection of the Promise.
  • Promise.catch
    Attaches a callback for only the rejection of the Promise.
  • Array.push
    Appends new elements to an array, and returns the new length of the array.
  • Array.length,
  • Array.map,
  • String.indexOf,
  • fetch,
  • Window.location,
  • Window.addEventListener,
  • ObjectConstructor.keys,
  • Array.forEach,
  • Location.reload,
  • Response.status,
  • Navigator.serviceWorker,
  • ServiceWorkerContainer.register,
  • ServiceWorkerRegistration.installing,
  • ServiceWorkerContainer.controller

Popular in JavaScript

  • path
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • winston
    A logger for just about everything.
  • minimatch
    a glob matcher in javascript
  • mime-types
    The ultimate javascript content-type utility.
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • moment
    Parse, validate, manipulate, and display dates
  • debug
    small debugging utility
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now