Allowing Framing for Selected Routes in an App

Hello Everyone,

I’m seeking help with an issue I’ve encountered with an application I’m currently working on.

The problem lies with the “BrowserPolicy” settings, which are currently set to disallow framing.

I understand that the method BrowserPolicy.content.allowFrameAncestorsOrigin() can be used to permit certain ancestors to frame the app.

However, my use case requires enabling framing for all on certain selected routes.

1 Like

Hello I have the same question.

isIframe = window.location !== window.parent.location

isIframe = window !== window.parent


function isIframe () {
    try {
        return window.self !==;
    } catch (e) {
        return true;

You can wrap your routes in these conditions and server the route or server something else (homepage).

The question is related to the usage of BrowserPolicy.
If you use BrowserPolicy.framing.disallow(); and/or BrowserPolicy.content.allowFrameAncestorsOrigin() how do you allow exceptions based on the route ?

@MickaelFM ok, that could be your question but I replied to the initial question where a framing for all on some routes implies basically framing for all.

The browser policy is baked into the bundle and I don’t think it can be altered on the fly at Meteor level. But what you can do is what you do anyway, write your logic in the router though I am not sure how would that go with SSR.