Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:59:01+00:00 2026-06-13T16:59:01+00:00

I open a window/tab in Chrome: childWin = window.open(‘child.html’); Then I try to call

  • 0

I open a window/tab in Chrome:

childWin = window.open('child.html');

Then I try to call a function in the child:

childWin.objReceiver( {foo: 'blah', zoo: 'bing'} );

But I get the following 2 errors in Chrome parent (Firefox works fine):

Unsafe JavaScript attempt to access frame with URL file:///C:/Users/Slava/Documents/AMP/app_poc/test/child.html from frame with URL file:///C:/Users/Slava/Documents/AMP/app_poc/test/index.html#. Domains, protocols and ports must match.
Uncaught TypeError: Property 'objReceiver' of object [object Window] is not a function

Please advise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:59:02+00:00Added an answer on June 13, 2026 at 4:59 pm

    When testing this kind of thing, you want to serve the documents from a real web server process (so the URL is http://...). The security policy browsers apply to local resources (your file:///... URLs) can be more restrictive than same-origin policies for a web resource. (Specifically: Some browsers treat local files as not matching any origin, even another local file in the same directory.)

    Just install a simple web server (or a complex one, if you prefer 🙂 ) on your machine.

    Another thing to be wary of is that you probably can’t call a function on the child window immediately, because the window may not be loaded yet. So you can watch for objReceiver showing up in the child, like so:

    jQuery(function($) {
    
      $("#target").click(function() {
        // Open the window
        var wnd = window.open("http://jsbin.com/ofigis/1");
    
        // Give it a 10th of a second to appear
        display("Window open, waiting for it to appear...");
        setTimeout(watchForWindow, 100);
    
        // Our function watching for it        
        function watchForWindow() {
          // Is it there?
          if (wnd.objReceiver) {
            // Good, we're done waiting -- send the message
            wnd.objReceiver({
              foo: "blah"
            });
    
            display("Message sent");
          }
          else {
            // Not there yet, keep waiting...
            setTimeout(watchForWindow, 0);
          }
        }
      });
    
      function display(msg) {
        $("<p>").html(String(msg)).appendTo(document.body);
      }
    
    });
    

    Live Example | Source

    (I’m using jQuery there just for convenience, none of the fundamental bits rely on it)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I window.open( http://blarg ) in chrome, I get a new tab. If I
I open a pop-up window using following code in main.html function openwindow(url) { window.open(url,
I try to open a new tab of Firefox extension (URL starts like chrome://xxx/content
I need to open a second browser window or tab, but it must have
Is it possible to open a terminal window with 3 tabs. Each tab should
Window.open javascript function is not working in Mozilla, but working in other browsers, here
How do I open a link in a new tab in the extension HTML.
I have a bookmarklet that needs to open a new window/tab. In order to
Creating a popup window from main page with window.open, the child/popup page uses the
I'm trying to use window.open to open a URL in a new tab or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.