473,385 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.

May 17 '07 #1
5 12834
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sentinel | last post by:
Hi all, I'm trying to reload a frame from a pop-up, but really cannot figure this out. Within my index.htm file, I make a link to call a pop-up frame with a javascript function that calls the...
5
by: spam_me_ not | last post by:
I already understand that one cannot disable a browser's forward and back functions. This is a situation where I have code working in Mozilla V1.6 and would like something similar for Opera and...
2
by: OtisUsenet | last post by:
Hello, I am trying to call Javascript from FORM's onSubmit, and return false, so the form is not actually submitted. Normally I can just add 'return false;' to onSubmit to accomplish this, like...
3
by: saiho.yuen | last post by:
Hi, Is anyone know what is the difference between Location.href and Window.location.href Thanks you very much:) Saiho
2
by: Brvsra | last post by:
Javascript Experts, I know very little about javascript and could use someone's help. I have created a function to send an email, listed below is the function. The function works fine, with...
3
by: Christian Hubinger | last post by:
Hi! I'm working on a page that uses javascript very much. My problem is now that i cannot redirect to another page in IE with window.location =<URL>; This command gets executed (proofed with...
8
by: johnsonholding | last post by:
Here is the code for a pop-up window that works in Firefox and not in IE - I get a java error or something, Here is the code : </script> <SCRIPT language="JavaScript"...
2
by: Robert Degen | last post by:
Hello, I got a little problem. Seems very simple: * I want to open a popup window * Popup-window uses data from its father window. BUT a parent.window does NOT point to the real parents...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.