473,721 Members | 1,825 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 12878
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
15110
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
5366
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 opened that is slightly larger insize then the images dimensions... The new window will contain the...
6
1607
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
5628
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
1358
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
3063
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 MyStream.Read(myBuffer, 0, CType(MyStream.Length, Integer)) HttpContext.Current.Response.BinaryWrite(myBuffer)
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 = ''
26
5686
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
8219
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, window is just a REFERENCE back to the global object, as opposed to a separate object.)
0
8834
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8727
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9212
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
9127
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
9056
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
5973
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
4483
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
2569
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2127
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.