window.location

JSP or JavaScript equivalent to PHP's $_SERVER["HTTP_HOST"]?

I've go an absolute URL in my JavaScript that I have hard coded for window.location. I don't want to have to change this every time I am testing my app. In PHP I would have handled this by testing the $_SERVER["HTTP_HOST"] variable to find out what server I am on, and adjust accordingly. However, I'm not as familiar with Java and am won...

What exactly can an IFrame do with the top.Location object (cross-domain)?

There is a very particular edge case in cross-domain policies regarding the window.top.Location object... Let's say I have IFrame A , in domain www.xxx.com, living inside a page in domain www.aaa.com. The page inside the IFrame can: Compare window.top.location to window.location (to detect whether it's being framed) Call window.top...

javascript window.parent issue

Hello everyone, I am new to Javascript and after reading related books for quite some time, I am still confused what is the meaning and what is the function of window.parent? Appreciate if someone could show me some simple samples to let me know what does window.parent mean? Thanks! Here is the code I am confused, and it is a part of J...

window.location = #anchor doesn't work in IE

On this map: http://web.pacific.edu/documents/marketing/campus-map/version%202/stockton-campus-2.0.htm I have an anchor at the top, and I want the page to jump to the anchor when a link is clicked. I'm currently using window.location = '#top'; It works as expected in FF, Opera, and Chrome, but not in IE 7. I've tried all permuta...

ExternalInterface.call("window.location.host.toString")

Hello Everyone, I wrote a flex application that get the host string from the browser using this code ExternalInterface.call("window.location.host.toString") This line of code work prefectally to get the host string in both Firefox and Opera. However, when using IE, the returned string is always 'null'. I need to get such information ...

Change hash without reload in jquery

Hello, I have the following code:- $('ul.questions li a').click(function(event) { $('.tab').hide(); $($(this).attr('href')).fadeIn('slow'); event.preventDefault(); window.location.hash = $(this).attr('href'); }); This simply fades a div in based on when you click but i want the page url hash tag to change when you click so people...

Scroll window after timeout

I would like to be able to use jQuery's scrollTo plugin to animate the window scroll down to a div when Google directions are loaded. Could someone please help me convert the setTimeout line to jQuery and use scrollTo to animate the scroll? Here is the javascript that doesn't scroll: GEvent.addListener(gdir, 'load', onGDirections...

Is window.location() same as a GET request?

Are cookies preserved while doing windows.location(url), if domain of url is the domain of the current page? ...

Firefox window.parent.location

I've a Html page index.htm which has an iframe to page search.htm the search.htm has code like this function executeSearch() { window.parent.location = "/SearchResults.aspx?t=" + txt_Search.value; } this code executed now from index.htm page and it works great on IE and Chrome, but not FireFox ... is there any work ar...

Changing window.location.href in Firefox in response to an onunload event

Hi, I have a strange JavaScript problem using window.location.href, which apparently only affects Firefox (I'm using 3.6). Normally window.location.href would not be read-only, and this works perfectly in FF: window.location.href = "http://google.com/"; However, when I call a function in response to an onunload event (), this doesn'...

What's the difference between window.location and document.location in JavaScript?

Should both of them reference to same object? ...

window.onbeforeunload and window.location.href in IE

We are using window.location.href to navigate the user to a page. Also, we have configured the window.onbeforeunload event to alert users in case there are any unsaved changes. window.onbeforeunload = confirmBeforeClose; function confirmBeforeClose() { if (jwd.global.inEditMode) return "Your changes will not be saved :) and...

NS_BINDING_ABORTED Javascript window.location.replace()

Hi all, I'm writing some Javascript code and I'm trying to change the current page as the result of the user clicking a button. I'm using this snippet of code: window.location.replace("/customer/order/12"); containing the relative URL within my site that I want to navigate to. When this code runs (looking at it in Firebug), the url st...

window.location call popup up empty dialog on safari

Hi, on a web page i am trying to redirect the browser to another page on the same site. the code is very simple for that: window.location = "/path1/path2" on safari - both windows as well as mac - a message box containing only the text "http://domain.com" comes up. I have tried different ways of specifying this: location.href, wi...

How to focus on a specific div using window.location = [x] in jquery.

I've got a window.location function that redirects to a site that is not programmed by me. When the window is relocated I need it to focus on a specific div tag (with an id) within that page. Is there a way for me to do that if the page is not mine and I do not have access to the code? UPDATE so I've got this now and it's working... ...

Triggering shouldStartLoadWithRequest with multiple window.location.href calls

Im trying to pass multiple things from a webpage inside a UIWebView back to my iPhone app via the shouldStartLoadWithRequest method of the UIWebView. Basically my webpage calls window.location.href = "command://foo=bar" and i am able to intercept that in my app no problem. Now if i create a loop and do multiple window.location.href cal...

Selenium RC: How to click buttons that use onclick window.location?

I have a button (outside of a form) that redirects to another page using the onclick attribute that calls window.location to redirect the user to another page. This time I can't change the HTML. I am using Safari 4 for testing. How can I click a button that uses the onclick attribute and window.location to redirect using Safari 4 and Sel...

JS to update the window Location with a URL not a HASH

Hello, I'm building a web app for Sign In / Registration etc, and do not want the page to have to refresh. www.mysite.com I know how to set a hash on the URL without refreshing the page: location.hash to give: www.mysite.com/#signin But what I want: www.mysite.com/signin Without the hash so it's SEO friendly. Also, once I set tha...

removing the # from window.location.hash

Hi. I have this simple script: $(document).ready(function(){ var $yoyo = window.location.hash; alert($yoyo); }); But I need to get rid of the # symbol as I'll be using the variable to locate div ids. I've tried using .remove('#') but that doesn't seem to be working. Many thanks in advance! ...

possible to replace window.location.hash?

I'm wondering whether it's possible to change the hash in window.location.hash and replace it with 'this.id'. Or would I need to change the entire window.location? Many thanks! ...