By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,008 Members | 2,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,008 IT Pros & Developers. It's quick & easy.

window.location.href with encode?

P: n/a
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.

May 17 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
so******@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/
May 17 '07 #2

P: n/a
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);
May 17 '07 #3

P: n/a
so******@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.

Gérard
--
Using Web Standards in your Web Pages (Updated Apr. 2007)
http://developer.mozilla.org/en/docs...your_Web_Pages
May 18 '07 #4

P: n/a
Gérard 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);

May 18 '07 #5

P: n/a
scripts.contact wrote:
if(opener && !opener.closed)
opener.location.reload(true);
Yes, that's better. Thanks!

Gérard
--
Using Web Standards in your Web Pages (Updated Apr. 2007)
http://developer.mozilla.org/en/docs...your_Web_Pages
May 19 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.