It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes Chrome question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Chrome question" Watch "Chrome question" New topic

Chrome question

Popescu Gabi

Joined: Nov 01, 2011
Posts: 7

I'll start by saying that i don't have a lot of experience with Javascript.

I created an iframe and i need it to communicate with the main window. I wrote this code in the main window (dropFrame being the iframe):

Of course, the iframe has a function called changeDragObject(obj). It works in IE, Opera and Mozilla but not in Chrome. Accessing Chrome's console, i see it throws these errors:

* Unsafe JavaScript attempt to access frame with URL file:///F:/Folder/DOM%20Drag%20Drop/dropPage.html from frame with URL file:///F:/Folder/DOM%20Drag%20Drop/MainPage.html. Domains, protocols and ports must match.
* Uncaught TypeError: Property 'changeDragObject' of object [object Window] is not a function

I'm guessing the second error is the one which leads to the crash, but i don't know why.
Could you tell me how to get rid of that error? Thank you.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You should never work off the file protocol when developing since it has different security restrictions than http. Use a local webserver, it is easy to set up/run.

I agree. Here's the link:
subject: Chrome question
It's not a secret anymore!