|
|
 |
 |
 |
 |
Javascript / Client Side Development
|
 |
 |
 |
 |
 |
 |
 |
 |
window.location.href with encode?
Hi, I have a pop up window, that window needs to refresh the parent window when opened, I'm doing the following: window.opener.location.href(window.opener.location.href); problem I'm having is that the parent url has a # sign in it, like: http://localhost/mysite/me.html#01 i need the #01 to stay in the url after the refresh, anyway to do this? i tried using escape(window.opener.location.href) but that didn't work, as it escaped everything including the :// in http:// i also tried window.opener.location.href(window.opener.location.protocol + "//" + window.opener.location.hostname + window.opener.location.pathname); problem with that was i lost the #01 in the url, pathname didn't include it... any ideas? Thanks.
soni2@yahoo.com said the following on 5/17/2007 4:14 PM:
> Hi, > I have a pop up window, that window needs to refresh the parent window > when opened, I'm doing the following: > window.opener.location.href(window.opener.location.href); > problem I'm having is that the parent url has a # sign in it, like: > http://localhost/mysite/me.html#01 > i need the #01 to stay in the url after the refresh, anyway to do > this? i tried using escape(window.opener.location.href) but that > didn't work, as it escaped everything including the :// in http:// > i also tried > window.opener.location.href(window.opener.location.protocol + "//" + > window.opener.location.hostname + window.opener.location.pathname); > problem with that was i lost the #01 in the url, pathname didn't > include it... > any ideas?
location.hash -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/index.html Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
On May 17, 2:14 pm, soni2@yahoo.com wrote: > Hi, > I have a pop up window, that window needs to refresh the parent window > when opened,
opener.location.reload(1);
soni2@yahoo.com wrote : > Hi, > I have a pop up window, that window needs to refresh the parent window > when opened, I'm doing the following: > window.opener.location.href(window.opener.location.href);
First, you need to verify that the opener reference still exists: this will make your javascript code robust, not triggering javascript errors: if(opener) { opener.location.reload(true); };
That call should be done only and only once the popup has been created and with the referenced resource loaded in the body node. Not tested. Grard -- Using Web Standards in your Web Pages (Updated Apr. 2007) http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_...
Grard Talbot wrote: > First, you need to verify that the opener reference still exists: this > will make your javascript code robust, not triggering javascript errors: > if(opener) > { > opener.location.reload(true); > };
if(opener && !opener.closed) opener.location.reload(true); |
 |
 |
 |
 |
|