web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Error with window.top.opener in Unified Client Interface

(0) ShareShare
ReportReport
Posted on by 7,316
Hi,
I have a client side script with window.top.opener line in it. This is where error is being thrown when debugged.
This script was working fine but started throwing this below error today.
Blocked a frame with origin "">http://www.<domain>.com" from accessing a cross-origin frame.

I know using window.top is not supported but it was working fine, so didn't look into it earlier.
Can somebody please let me know what this error means and how to fix it?
Thanks for any help.

I have the same question (0)
  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at

    Hello,

    As suggested, you should avoid using the window.top. if you can, let us know what your requirement and we can suggest alternative design approach.

    Here is a link for your reference.

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/use-iframe-and-web-resource-controls-on-a-form#enabling-iframe-communication-across-domains

    Best Regards

    PG

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi meenoo,

    window.top is not supported. When used, The following script error will be displayed to users or included in your error logs: Error: Blocked a frame with origin "https://<yourinstance>.dynamics.com" from accessing a cross-origin frame. The error means that you are trying to access a window owned by an application context external to Dynamics 365. Due to the differing origins, the browser presents the user with a cross-origin security error.

    The following are the recommended approaches:

    • Avoid usage of the window.top object altogether.

    • If using window.top is the only available option, first test to determine whether window.top is accessible by using the script below. If it's not available, provide alternate logic or a fallback user experience.

    function isTopAccessible() {
        try {
                window.top.location;
                return true;
            }
            catch (err) {
                return false;
            }
    }
    
    var canAccess = isTopAccessible();
    alert(canAccess);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
whitebeard Profile Picture

whitebeard 68

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 66 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 40 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans