Questions tagged [location-href]

JavaScript run in a browser has access to both the Document.location and Window.location which has a href property containing the whole URL associated with the content.

JavaScript run in a browser has access to both the Document.location and Window.location which has a href property containing the whole URL associated with the content.

References

177 questions
3
votes
0 answers

Cypress location.href calls /__/ url (double underscore)

The javascript in the page of application under test makes use of location.href='Dashboard.aspx'. Running a test against this page is making the url call to get /__/Dashboard.aspx. I have witnessed this also in Firefox. I notice that there is a bug…
3
votes
2 answers

How can i solve Uncaught TypeError: Cannot read property 'top' of undefined

i have one page website. i added smoothscroll with js. $(document).ready(function(){ $("li > a").on('click', function(e) { if (this.hash !== "") { e.preventDefault(); var hash = this.hash; $('html, body').animate({ …
Reza
  • 119
  • 2
  • 9
3
votes
2 answers

Change URL without removing history in Angularjs

I'm using 'ui.router' and '$state.go' to redirect page, 'navbar' of my project looks like this.
3
votes
1 answer

create dynamic link based on text input field

I'm trying to make a text input field where visitors can enter a value and then hit go or submit. Based on the digit number they would be send to a new page. For example if they enter 123 and hit submit it would send them to…
Reza Abbasian
  • 43
  • 1
  • 1
  • 5
3
votes
2 answers

Angular.js - create url using $location service

Is there a way to do it? If the current url is say.. /table?sort=activity and I wanted to update it right away, I'd do $location.url(null, {sort: 'something'}) but what if I wanted to get back the updated url /table?sort=something without updating…
fxck
  • 4,898
  • 8
  • 56
  • 94
3
votes
3 answers

Declare a variable in a URL and assign it a value in Javascript when navigating to a page

I'm relatively new to HTML (and programming in general), and I'm trying to declare a variable and assign it a value when I navigate to a page. What I have is a line of code like this: function() navigate {window.location =…
HashFail
  • 536
  • 1
  • 5
  • 14
2
votes
1 answer

Matching a path with query variables in React

Assume I have the following pages on my website Page 1: example.com/somepage.php?action=a Page 2: example.com/somepage.php?action=b Page 3: example.com/somepage.php?action=b&other=c IMPORTANT NOTE: I do not have control of the URL paths, this is…
Greeso
  • 7,544
  • 9
  • 51
  • 77
2
votes
3 answers

jQuery: Active state: AddClass to a link that contains the document.href as href

I'm wondering if its possible to addClass to a link, that has the same href as the document.href? I tried, but without any luck. if ($("a").attr("href") == document.location.href) { $(this).addClass("active"); } Isn't this possible??
curly_brackets
  • 5,491
  • 15
  • 58
  • 102
2
votes
2 answers

Selecting the anchor tag of a particular href using jQuery

THE AIM After refreshing the browser, I would like that the user stays in the menu/content they were before refreshing. THE PROBLEM After refreshing the browser, the content of the particular menu in which the user was before refreshing is shown as…
Joehat
  • 979
  • 1
  • 9
  • 36
2
votes
2 answers

Routings href in Cherrypy

I don't know how make routings in cherrypy and how define css and js file in conf in index.py I have a structure: index.py | -views | -home | -index.html -login.html -public | -css bootstrap.css ... -js -images And when…
Tom
  • 31
  • 3
2
votes
0 answers

Why is 'window.location.href' returning "about:blank" in this userscript?

This very simple userscript has been getting the best of me: // ==UserScript== // @name TEMP // @match https://*.facebook.com/ // @match https://*.facebook.com/?* // @grant none // @run-at document-start //…
Marc.2377
  • 7,807
  • 7
  • 51
  • 95
2
votes
1 answer

Jquery: Make entire block clickable, while preserving the ability to open in a new tab/window

I don't want to use css to expand the link width/height etc. With my code, the entire LI is clickable, it opens the a link found within it. I've preserved the middle mouse click to open the link in a new window. I'm wondering if someone who…
android.nick
  • 11,069
  • 23
  • 77
  • 112
2
votes
1 answer

I want to change language url using jquery

I want to change language URL using jquery. My url is https://beta.yourtaxi.ch/de_DE/about-us/ and want to change it just https://beta.yourtaxi.ch/en_Us/about-us/. I have tried below code but not working. $('a[rel="group"]').on('click',…
priyapatel
  • 73
  • 1
  • 1
  • 7
2
votes
2 answers

Insert string to url and redirect

Is it possible to insert a stringi into url? Lets say I want www.domain.com/news to insert language flag de between com and news
Damian Doman
  • 522
  • 8
  • 19
2
votes
0 answers

A href intent link (launch android app) not working by JQuery

I have strange problem. I want to launch my custom android app from my web app on browser. I have followed the article here http://androidsrc.net/launch-android-application-from-browser-using-uri/. And it worked, I successfully trigger my app when…
1
2
3
11 12