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
0
votes
1 answer

make a script after document.location.href

I want to add an alert("some text") message after document.location.href or some kind of related code. ex: document.location.href = "http://www.msn.com"; windows.alert("You are now at msn.com"); By the moment I use document.location.href I…
0
votes
3 answers

Deal with query strings in JS, like http_build_query, etc

Here's what I have if(condition1) { location.href = location.href+'/?site_type=normal'; } else if(condition2) { location.href = location.href+'/?site_type=other'; } Of course, if the location.href already has query vars on it, thats a…
Doug Cassidy
  • 1,796
  • 3
  • 17
  • 28
0
votes
1 answer

why href tag always open new window?

This is my code of jsp page
BhavikKama
  • 8,566
  • 12
  • 94
  • 164
0
votes
1 answer

Setting the href attribute of an a element in IE 8 or 9

How you you set the href attribute of an a element? This function works in FF, CHROME, and SAFARI but not in IE 8 or 9. In IE 8 or 9, both vars location and href only display "#" var getLocation = function(href) { l =…
0
votes
1 answer

Change href on unload (or location.href change)

There are several links (and pieces of Javascript) throughout our site that contain /2012/responses/{pathParams...} and I now need to conditionally add to the path, if it's a webview. if (isWebview) { // use…
ravun
  • 1,523
  • 9
  • 27
  • 45
0
votes
4 answers

Open a PHP page with window.location in Javascript is not working

How do I open a php page from javascript function ? window.location = "http://www.google.com"; window.location.href = "http://www.google.com"; location.href = "http://www.google.com"; None of them is working. Even put in php.ini allow_url_fopen =…
user1702736
  • 51
  • 1
  • 6
0
votes
6 answers

Why isnt location.href() working?

I just want the new page to appear in an iframe on the current page instead of loading a whole new page. Here's my code: function salabim(id){ var gotoo; var objid = document.getElementById("pgMaster"); new Effect.Shake(id); return…
0
votes
1 answer

jQuery: find element with an href of X

I need to be able to check the following: $(".main-menu a") For a specific href attribute and then addClass
dcolumbus
  • 9,596
  • 26
  • 100
  • 165
0
votes
1 answer

location.href + specifying the search parameters

I am trying to load the url of a search page by specifying both the path I want to load and the search parameters that should be appended. For example I'm loading /foo/?q=1&a=2 I would try to type something in javascript like this: location.href =…
cvocvo
  • 1,586
  • 2
  • 23
  • 38
0
votes
1 answer

JavaScript: Ways to open a new page in the same window

location.href location.replace document.URL As seen from other similar questions, can we consolidate all such possible methods?
Pop Stack
  • 926
  • 4
  • 19
  • 27
0
votes
1 answer

Button onClick event and Href-Location

I used a solution given by "Chrules" found in this discussion:buttons with no href, onclick etc like this : ...... $("#clickable").click(function(){ // Send user to this link insertRecord(); //SQLite…
Amira Manai
  • 2,599
  • 8
  • 40
  • 60
-1
votes
1 answer

open external URL but opens localhost:3000/www.google.com

I am trying to open an external URL , but instead of opening www.google.com in a new tab , it opens http://localhost:3001/www.google.com
Jose A.
  • 483
  • 2
  • 7
  • 15
-1
votes
1 answer

How do I stop the content with onChange?

I have this problem with onchange: