473,763 Members | 9,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.l ocation.href(wi ndow.opener.loc ation.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.o pener.location. href) but that
didn't work, as it escaped everything including the :// in http://

i also tried
window.opener.l ocation.href(wi ndow.opener.loc ation.protocol + "//" +
window.opener.l ocation.hostnam e + window.opener.l ocation.pathnam e);

problem with that was i lost the #01 in the url, pathname didn't
include it...

any ideas?

Thanks.

May 17 '07 #1
5 12909
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.l ocation.href(wi ndow.opener.loc ation.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.o pener.location. href) but that
didn't work, as it escaped everything including the :// in http://

i also tried
window.opener.l ocation.href(wi ndow.opener.loc ation.protocol + "//" +
window.opener.l ocation.hostnam e + window.opener.l ocation.pathnam e);

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.javas cript 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.l ocation.href(wi ndow.opener.loc ation.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
4580
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 following code from an external javascript source file, dynamically created with PHP document.write('<a href="javascript:void(0);"
5
7540
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 IE. I link within a page and display individual divisions of that page, manipulating their visibility and display styles with an onClick function. As long as I explicitly click a link to progress, it works with browsers I've tried.
2
3308
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 so: <form name="XX" method="get" action="/Foo" onsubmit="onSearch(); return false;">
3
50425
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
872
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 one exception. When the function is passed, the popup screen only displays the first part of the querystring. The email address returns: http://server.something.asp?Test=1 Should return something like this:
3
23008
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 alert messages) but nothing happens. FF acts like expected but i cant get it work in IE. What can be the problem here? here the code i use:
8
2494
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" type="text/javascript"> <!-- ; var newwindow = ''
2
19241
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 window. Alerting parent.window.location.href shows me, I'm at the wrong window location.
18
3349
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 the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I run the code on my local computer but I do have it when I run the code on geocities.
0
10148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.