473,472 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

new window - can't read property

hello. I've code like this:

var x =window.open('http://localhost/canvas.html','myokno')
var w =x.width
Permission denied to get property Window.width
var w =x.innerWidth

Permission denied to get property Window.innerWidth
why i can get properties of new created window???
The second problem is much more important:
i want to get element which id is "canvas" and it is in new window so i do
like this:

var canvas = myokno.document.getElementById('canvas')
ReferenceError: myokno is not defined
var canvas = x.document.getElementById('canvas')
Permission denied to call method HTMLDocument.getElementById

so i start working on the problem and:
var can = x.document
can
[object HTMLDocument]
var can2 = can.getElementById('canvas')
Permission denied to call method HTMLDocument.getElementById

what i doing wrong?
Any help will be appreciated.
Sep 30 '05 #1
2 12859
Hi Grzegorz Slusarek,

Grzegorz Slusarek wrote:
hello. I've code like this:

var x =window.open('http://localhost/canvas.html','myokno')
var w =x.width
Permission denied to get property Window.width well, the popup window and the script which initiated it must be in the
same domain. (for eg). when you have a html file in "c:\sample.htm",
from which you popup "http://localhost/canvas.html", you cannot access
its properties. Its a security thing that browsers have implemented. So
copy the sample.htm to your localhost access it as
'http://localhost/sample.htm'.
var w =x.innerWidth

Permission denied to get property Window.innerWidth
why i can get properties of new created window???
The second problem is much more important:
i want to get element which id is "canvas" and it is in new window so i do
like this:

var canvas = myokno.document.getElementById('canvas')
ReferenceError: myokno is not defined wrong.... use 'x' as you have done below.
var canvas = x.document.getElementById('canvas')
Permission denied to call method HTMLDocument.getElementById

so i start working on the problem and:
var can = x.document
can
[object HTMLDocument]
var can2 = can.getElementById('canvas')
Permission denied to call method HTMLDocument.getElementById

what i doing wrong?
Any help will be appreciated.


-- Peroli Sivaprakasam

Sep 30 '05 #2
Grzegorz ¦lusarek a écrit :
hello. I've code like this:

var x =window.open('http://localhost/canvas.html','myokno')
var w =x.width
Permission denied to get property Window.width
var w =x.innerWidth

Permission denied to get property Window.innerWidth
why i can get properties of new created window???
Read the WindowObjectReference definition
http://developer.mozilla.org/en/docs...and_parameters
and then the last question of the FAQ
http://developer.mozilla.org/en/docs...indow.open#FAQ
The second problem is much more important:
i want to get element which id is "canvas" and it is in new window so i do
like this:

var canvas = myokno.document.getElementById('canvas')
ReferenceError: myokno is not defined
When you created the window, the returned value was not stored in a
variable with the identifier "myokno": that's what the error message is
saying. Without being able to examine your code, it's impossible to
comment more.
var canvas = x.document.getElementById('canvas')
Permission denied to call method HTMLDocument.getElementById

so i start working on the problem and:
var can = x.document
can
[object HTMLDocument]
var can2 = can.getElementById('canvas')
Permission denied to call method HTMLDocument.getElementById

what i doing wrong?
Any help will be appreciated.


There are examples and best practices at this page:

http://developer.mozilla.org/en/docs/DOM:window.open

Basically, you are trying to modify (or set or get) properties or call
methods from one window to another which do not share the same domain
name: you can't do that... there are security reasons for this.

Gérard
--
remove blah to email me
Oct 3 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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: Randell D. | last post by:
HELP! Its taken me ages - I'm a newbie and I've compiled bits of code that I've read in this newsgroup over time to create one of my most intricate functions to date... Basically, the script...
6
by: Don | last post by:
Hi, I have the following script that displays a popup window centered in the middle of the screen. I am getting a script error in both IE and Netscape but I don't know what it means. Thanks in...
3
by: anonieko | last post by:
You can try this code: > > > > > <!--- filename: mypage.html ----> <html> ....blah blah blah <script language=JavaScript src=/Javascript/center.js></script>
2
by: Anita C | last post by:
Hi, On a web form, in the click event of a button I want to open a .htm file in a new window. However I only know the path of the shortcut which points to file that needs to be viewed in the new...
6
by: G Dean Blake | last post by:
in my aspx app I am writing a stream that works fine but it replaces what is in the client browser window. The code is as follows: .. .. HttpContext.Current.Response.ClearHeaders()...
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"...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
24
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and...
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
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
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.