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

  • Home
  • SEARCH
  • 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 8081361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:42:28+00:00 2026-06-05T16:42:28+00:00

So there is a parent page on one domain that includes an iframe from

  • 0

So there is a parent page on one domain that includes an iframe from a different domain.

I am trying to navigate parent page from the iframe using a relative path that would take base url from the parent.

I tried with

<script type="text/javascript">
     function navigateParent(targetPage) {
        var url = window.parent.location.href;
        if (url.indexOf('.') > -1) {
             url = url.substring(0, url.lastIndexOf('/') + 1);
        }
        window.parent.location = url + targetPage;
     }
</script>

but this produces an error:

Unsafe JavaScript attempt to access frame with URL …my parent url… with URL …my iframe url… . Domains, protocols and ports must match.

Is there any way to do this? Ie specifiying some cross-domain permission or something.

  • 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-05T16:42:30+00:00Added an answer on June 5, 2026 at 4:42 pm

    Cross domain protections are now serverly enforced browser-side to protect the user (following some cross domain injections).

    To call a function or change a property in a frame/window served by another domain you can

    • specify CORS headers on the server (this tells the browser that cross domain communication is fine)

    • preferred : use postMessage to communicate between windows and frames

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

Sidebar

Related Questions

All my PHP pages work fine but there is one PHP page that used
I have two pages, the parent and from this page I am using: window.open('OrderDetailsFull.aspx?ObjectID='
I have a page that contains a parent record and several children records. There
Is there any way to listen for keypress events in a parent page while
Possible Duplicate: Is there a CSS parent selector? CSS selector for “foo that contains
There is a class called Parent which in generated from a xsd file and
Is there any way that parent tag styles do not apply to child tag
I'm looking for a solution that allows me to get the parent page pathname
I'm trying to put two divs on the right side of parent div one
In my activity page ,there is a layout which contains one listview at top(listview1),below

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.