Start the hash change handling, returning `true` if the current URL matches an existing route, and `false` otherwise.
325797
function(options) {
      if (History.started) throw new Error('Backbone.history has already been started');
      History.started = true;

      // Figure out the initial configuration. Do we need an iframe?
      // Is pushState desired ... is it available?
      this.options          = _.extend({root: '/'}, this.options, options);
      this.root             = this.options.root;
      this._wantsHashChange = this.options.hashChange !== false;
      this._hasHashChange   = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
      this._useHashChange   = this._wantsHashChange && this._hasHashChange;
      this._wantsPushState  = !!this.options.pushState;
      this._hasPushState    = !!(this.history && this.history.pushState);
      this._usePushState    = this._wantsPushState && this._hasPushState;
      this.fragment         = this.getFragment();

      // Normalize root to always include a leading and trailing slash.
      this.root = ('/' + this.root + '/').replace(rootStripper, '/');

      // Transition from hashChange to pushState or vice versa if both are
      // requested.
      if (this._wantsHashChange && this._wantsPushState) {

        // If we've started off with a route from a `pushState`-enabled
        // browser, but we're currently in a browser that doesn't support it...
        if (!this._hasPushState && !this.atRoot()) {
          var rootPath = this.root.slice(0, -1) || '/';
          this.location.replace(rootPath + '#' + this.getPath());
          // Return immediately as browser will do redirect to new url
          return true;

        // Or if we've started out with a hash-based route, but we're currently
        // in a browser where it could be `pushState`-based instead...
        } else if (this._hasPushState && this.atRoot()) {
          this.navigate(this.getHash(), {replace: true});
        }

      }

      // Proxy an iframe to handle location events if the browser doesn't
      // support the `hashchange` event, HTML5 history, or the user wants
      // `hashChange` but not `pushState`.
      if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {
        this.iframe = document.createElement('iframe');
        this.iframe.src = 'javascript:0';
        this.iframe.style.display = 'none';
        this.iframe.tabIndex = -1;
        var body = document.body;
        // Using `appendChild` will throw on IE < 9 if the document is not ready.
        var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;
        iWindow.document.open();
        iWindow.document.close();
        iWindow.location.hash = '#' + this.fragment;
      }

      // Add a cross-platform `addEventListener` shim for older browsers.
      var addEventListener = window.addEventListener || function(eventName, listener) {
        return attachEvent('on' + eventName, listener);
      };

      // Depending on whether we're using pushState or hashes, and whether
      // 'onhashchange' is supported, determine how we check the URL state.
      if (this._usePushState) {
        addEventListener('popstate', this.checkUrl, false);
      } else if (this._useHashChange && !this.iframe) {
        addEventListener('hashchange', this.checkUrl, false);
      } else if (this._wantsHashChange) {
        this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
      }

      if (!this.options.silent) return this.loadUrl();
    }
563444
def should_strip_auth(self, old_url, new_url):
        """"""
        old_parsed = urlparse(old_url)
        new_parsed = urlparse(new_url)
        if old_parsed.hostname != new_parsed.hostname:
            return True
        # Special case: allow http -> https redirect when using the standard
        # ports. This isn't specified by RFC 7235, but is kept to avoid
        # breaking backwards compatibility with older versions of requests
        # that allowed any redirects on the same host.
        if (old_parsed.scheme == 'http' and old_parsed.port in (80, None)
                and new_parsed.scheme == 'https' and new_parsed.port in (443, None)):
            return False

        # Handle default port usage corresponding to scheme.
        changed_port = old_parsed.port != new_parsed.port
        changed_scheme = old_parsed.scheme != new_parsed.scheme
        default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None)
        if (not changed_scheme and old_parsed.port in default_port
                and new_parsed.port in default_port):
            return False

        # Standard case: root URI must match
        return changed_port or changed_scheme
453931
function( url, data ) {
            data = data || {};

            //if there's forward history, wipe it
            if ( this.getNext() ) {
                this.clearForward();
            }

            // if the hash is included in the data make sure the shape
            // is consistent for comparison
            if ( data.hash && data.hash.indexOf( "#" ) === -1) {
                data.hash = "#" + data.hash;
            }

            data.url = url;
            this.stack.push( data );
            this.activeIndex = this.stack.length - 1;
        }
233959
private void onFinishLoading() {
    // save the current hash
    String hashOnStart = this.plugin.getStartRoute(isUsingHash());
    // check if the url contains a hash.
    // in case it has a hash, use this to route otherwise
    // use the startRoute from the annotation
    if (hashOnStart != null &&
        hashOnStart.trim()
                   .length() > 0) {
      ClientLogger.get()
                  .logDetailed("AbstractApplication: handle history (hash at start: >>" + hashOnStart + "<<",
                               1);
      RouteResult routeResult;
      try {
        routeResult = this.router.parse(hashOnStart);
      } catch (RouterException e) {
        return;
      }
      this.router.route(routeResult.getRoute(),
                        routeResult.getParameterValues()
                                   .toArray(new String[0]));
    } else {
      ClientLogger.get()
                  .logDetailed("AbstractApplication: no history found -> use startRoute: >>" + this.startRoute + "<<",
                               1);
      this.router.route(this.startRoute);
    }
    ClientLogger.get()
                .logSimple("AbstractApplication: application started",
                           0);
  }
435933
function(path) {
		var newProps = route.deparam(path),
			oldProps = route.deparam(getCurrentUrl()),
			method = "pushState",
			changed = {};

		// Adds window.location.hash to path if it's not already in path.
		if (this.keepHash && path.indexOf("#") === -1 && window.location.hash) {
			path += window.location.hash;
		}

		// The old state and new state are diffed 
		// to figure out which keys are changing.
		diffObject(oldProps, newProps)
			.forEach(function(patch) {
				// `patch.key` refers to the mutated property name on `newProps`.
				return changed[patch.key] = true;
			});

		// If any of the changed properties are in `replaceStateKeys` or 
		// `replaceStateOnceKeys` change the method to `'replaceState'`.
		if (this.replaceStateKeys.length) {
			this.replaceStateKeys.forEach(function(replaceKey) {
				if (changed[replaceKey]) {
					method = "replaceState";
				}
			});
		}
		
		if (this.replaceStateOnceKeys.length) {
			this.replaceStateOnceKeys
				.forEach(function(replaceOnceKey, index, thisArray) {
					if (changed[replaceOnceKey]) {
						method = "replaceState";
						// Remove so we don't attempt to replace 
						// the state on this key again.
						thisArray.splice(index, 1);
					}
				});
		}
		window.history[method](null, null, bindingProxy.call("root") + path);
	}
473615
def replace_hash_at_path(hash, key, value)
      path = JsonPath.new(key).path
      if !value.nil?
        # REVIEW: Is there a better way to parse the JSON Path and ensure
        # a value at the location?
        (0...(path.length - 1)).each do |i|
          eval("hash#{path[0..i].join('')} ||= {}")
        end
        eval("hash#{path.join('')} = #{value.inspect}")
      elsif JsonPath.new(key).on(hash).count > 0
        # Path value is present, but we need to unset it
        leaf_key = eval(path[-1]).first
        eval("hash#{path[0...-1].join('')}.delete(#{leaf_key.inspect})")
      end

      hash
    end
67738
function (path, timeout) {
    return this.execute(function (path) {
      Router.go(path);
    }, [ path ])
    .wait(timeout || DEFAULT_TIMEOUT, 'until current path is ' + path, function (path) {
      
      var controller = Router.current();
      var pathOK = (window.location.pathname + window.location.search + window.location.hash === path);

      if (controller && pathOK && controller.ready()) {
        return true;
      } else {
        Router.go(path);
      }
    }, [ path ]);
  }
827365
function () {
    // Create and attach our main view
    this.mainView = new MainView({
      model: this.me,
      el: document.body
    });

    // this kicks off our backbutton tracking (browser history)
    // and will cause the first matching handler in the router
    // to fire.
    this.router.history.start({
      root: '/',
      pushState: true
    });
  }
166462
def _maybe_handle(self, prefix, handler, path, params, data=None):
    """"""
    if path.startswith(prefix):
      relpath = path[len(prefix):]
      if data:
        handler(relpath, params, data)
      else:
        handler(relpath, params)
      return True
    else:
      return False
605773
function compareUrlRoute(currentURL, currentRoute) {
                var regex = /\{(.*)\}/i;
                var arraySize = currentRoute.length,
                    testValue = false;
                for (var i = 0; i < arraySize; i++) {
                    var dynamic = regex.exec(currentRoute[i]);
                    if (dynamic) {
                        document.routeParams[dynamic[1]] = currentURL[i];
                    } else {
                        if (currentRoute[i] === currentURL[i]) {
                            testValue = true;
                        }
                    }
                }

                return testValue;
            }
889412
async function main() {
  event.$emit('before-client-render')

  if (globalState.initialData) {
    dataStore.replaceState(globalState.initialData)
  }

  await routerReady(router)

  if (router.getMatchedComponents().length === 0) {
    throw new ReamError(pageNotFound(router.currentRoute.path))
  }
}
647243
function isAnchor(href) {
    try {
        var parsed = url.parse(href);
        return !!(!parsed.protocol && !parsed.path && parsed.hash);
    } catch(err) {
        return false;
    }
}
629914
function _dynamicBeginning() {

  // If the route starts out as a dynamic segment, then find where
  // the location should start.
  if(_routeBoom[0] === '**') {

    dbug('Found dynamic beginning on ' + _routeBoom.join('/'));

    var oldLength = _locationBoom.length;    // Save the current length for comparison later

    for(var f = 0; f < _locationBoom.length; f++) {
      if(_locationBoom[f] === _routeBoom[1] || _routeBoom[1] === "*") {
        f = (f === 0) ? 1 : 0;      // We need to definitely remove at least one thing
        _locationBoom.splice(0, f); // Remove the beginning segments since the dynamic route handles them
        _routeBoom.splice(0, 1);    // Remove the ** from the route
        break;
      }
    }

    // If location_boom never gets truncated, then this isn't the right route
    if(oldLength === _locationBoom.length) return false; 
  }

  return true;
}
1097968
def if_string_digest_changed(key, input, &block)
      if_string_changed(key, Digest::SHA256.new.update(input.to_s).hexdigest.to_s, &block)
    end
845079
private boolean hasHashChanged(Set<RegData> regData) {
        for (RegData el : regData) {
            if (hasHashChanged(mHasher, el)) {
                Log.d("CHANGED", el.getURLExternalForm());
                return true;
            }
        }
        return false;
    }
574923
function switchRouteMatcher(on, when) {
      // TODO(i): this code is convoluted and inefficient, we should construct the route matching
      //   regex only once and then reuse it
      var regex = '^' + when.replace(/([\.\\\(\)\^\$])/g, "\\$1") + '$',
          params = [],
          dst = {};
      forEach(when.split(/\W/), function(param) {
        if (param) {
          var paramRegExp = new RegExp(":" + param + "([\\W])");
          if (regex.match(paramRegExp)) {
            regex = regex.replace(paramRegExp, "([^\\/]*)$1");
            params.push(param);
          }
        }
      });
      var match = on.match(new RegExp(regex));
      if (match) {
        forEach(params, function(name, index) {
          dst[name] = match[index + 1];
        });
      }
      return match ? dst : null;
    }
1276858
def match(self, route):
        
        _resource = trim_resource(self.resource)
        self.method = self.method.lower()
        resource_match = route.resource_regex.search(_resource)
        if resource_match is None:
            return None

        # build params and querystring
        params = resource_match.groupdict()
        querystring = params.pop("querystring", "")
        setattr(self, "param", params)
        setattr(self, "query", parse_querystring(querystring))

        return copy.deepcopy(self)