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
201
votes
7 answers

Having links relative to root?

Is there a way to have all links on a page be relative to the root directory? For example, on www.example.com/fruits/apples/apple.html I could have a link saying: Back to Fruits List Would this link be pointing to…
Ali
  • 261,656
  • 265
  • 575
  • 769
23
votes
3 answers

FancyBox close from within iframe and take parent page to the link

I found applying the following function to a links onclose works to close Fancybox from within an iFrame: parent.$.fancybox.close(); I want to take this further and have the link take the parent page to a new url. I've tried the following but it…
Mr Jonny Wood
  • 3,806
  • 5
  • 30
  • 42
21
votes
2 answers

Reload a page with location.href or window.location.reload(true)

I need to reload a page in a success of an ajax call. I'm seeing some code (not mine) and there are two ways: success: function(obj) { //code location.href = location.href; } or success: function(obj) { //code …
pmiranda
  • 7,602
  • 14
  • 72
  • 155
16
votes
1 answer

Uncaught TypeError: Undefined is not a function on indexOf

I currently have this code to check the website URL GET options for a specific ID, but whenever this code is run, I get a weird error: Uncaught TypeError: Undefined is not a function Here is my code: I want to be able to read the q=xyz query parameter from within code.js. I tried: console.log(window.location.href) But it gives me the html…
at.
  • 50,922
  • 104
  • 292
  • 461
5
votes
2 answers

JavaScript redirect (location.href) breaks the Back button unless setTimeout() is used

I just came across some odd behavior in Firefox 3.6/Mac. I suspect that it's general Firefox behavior, though. I created two dead-simple test pages that change the window.location.href property to navigate to new…
Bungle
  • 19,392
  • 24
  • 79
  • 106
5
votes
1 answer

HTML Email button link not working

I am trying to create a button in an HTML email that goes to a link in a href tag. I have practically no understanding of html code to be honest. This is what I'm trying:

Alex S
  • 53
  • 1
  • 4
1
2 3
11 12