473,569 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

new window - can't read property

hello. I've code like this:

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

Permission denied to get property Window.innerWid th
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.getE lementById('can vas')
Permission denied to call method HTMLDocument.ge tElementById

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

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

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

var x =window.open('h ttp://localhost/canvas.html','m yokno')
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.innerWid th
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.getE lementById('can vas')
Permission denied to call method HTMLDocument.ge tElementById

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

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('h ttp://localhost/canvas.html','m yokno')
var w =x.width
Permission denied to get property Window.width
var w =x.innerWidth

Permission denied to get property Window.innerWid th
why i can get properties of new created window???
Read the WindowObjectRef erence 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.getE lementById('can vas')
Permission denied to call method HTMLDocument.ge tElementById

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

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
15101
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 to achieve the above which does not work: <script language="jscript"> function PageRedirection() { if(!opener)
2
5351
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 gets called with a single arguement (full path to an image). The image is supposed to be downloaded to the cache, and when complete, a new window...
6
1597
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 advance. The error is ------------ Error: win has no properties Line 13 below ( win.window.focus(); )
3
5622
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
1353
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 window. What server side code do I use to do the above ? Thanks a ton.
6
3055
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() HttpContext.Current.Response.ClearContent() HttpContext.Current.Response.ContentType = "application/pdf" Dim myBuffer(MyStream.Length) As Byte...
8
2476
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 = ''
26
5649
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 several parts of the DOM, but this does not include the window object. Thank you
24
8196
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 seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading,...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
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...
1
7679
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...
0
6287
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...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
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...
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
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.