473,414 Members | 1,777 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,414 software developers and data experts.

Problem with window.opener!

So..
I have a javascript that makes a popup with a javscript function in it.
The function in the popup after 5 seconds tries to change the "price" field value in the opener window:

Expand|Select|Wrap|Line Numbers
  1. sourze= "<script type=%20text/javascript%20>
  2. function change(){ window.opener.document.forms[0].price.value=123;};
  3. setTimeout('change()',5000);</script>"; 
  4. thepopup=window.open( '' , 'name' , 'height=5,width=5');
  5. logs.document.writeln(sourze);  
  6.  
This bunch of code is working perfectly if it is run from the page where the "price" field is.

BUT..

Im trying to launch this script from one page and the "price" field is in another page. So I add to this code one more line

Expand|Select|Wrap|Line Numbers
  1. window.location="http://www.anotherpage.com"; 
  2.  
So the script should make a popup with the function and redirect itself. After 5 seconds the popup changes the fields "price" value.
The whole script looks like this:
Expand|Select|Wrap|Line Numbers
  1. sourze= "<script type=%20text/javascript%20>
  2. function change(){ window.opener.document.forms[0].price.value=123;};
  3. setTimeout('change()',5000);</script>"; 
  4. thepopup=window.open( '' , 'name' , 'height=5,width=5');
  5. logs.document.writeln(sourze);
  6. window.location="http://www.anotherpage.com"; 
  7.  
Why the hack it is not working?? The popup opens correctly. The main page redirects correctly, but the field changing is not wokring! :mad:
Aug 23 '05 #1
2 4376
Anyone? Maybe it is connected with that the opener somehow changes if the ite is changed?
Aug 23 '05 #2
acoder
16,027 Expert Mod 8TB
If the site changes, the page is no longer from the same domain. If the popup would be allowed to access the parent window then, it would be a security hole.
Jun 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Johan Daine | last post by:
Hi everyone, I have a main page (search engine) that pops up a window in wich the user can select a keyword in a select box (up to 4 keywords) The on change attribute of the select tag calls the...
8
by: Renuka | last post by:
I have a confirmation page with an OK button. If this window has an opener then this browser window needs to go to another URL or else the window must close. Thus I have the following javascript...
2
by: Fabrice Labrousse | last post by:
Hello, Here is a hard problem i cannot solve about window.opener method I think you'll need to be a specialist to find the solution... i can't find the solution by myself ! Please help me. Here...
7
by: Nick | last post by:
I've a main html file which will pop up a window with a image. In the main Window, I have the following code: w = window.open('popup.html') alert(w.document.images.length) And the alert shows...
1
by: fogwolf | last post by:
First a basic outline of what I am trying to do: I want to have a page spawn a pop-up when you click "submit" on its form. On this pop-up page there will be another form. When you click "submit"...
2
by: Snolly | last post by:
Hi all, Here is my issue. I have a web page (lets call it page1) with an iframe in it that then opens a pop-up window (page2). The pop-up window is used to edit some data that was loaded into...
2
by: JPL Verhey | last post by:
(i hope somebody (else) will read and have an idea! Thnx) Hi, With a script in a popup window, I want to check if certain content is present in a page loaded into the frame "main" of the...
1
by: JF | last post by:
Hi, I need to change the location of the parent window and after that scroll a little bit (because of "position:fixed" css buttons, which obscure the title). I have...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
5
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.