Giter Club home page Giter Club logo

Comments (3)

niutech avatar niutech commented on June 19, 2024

Could you show me a demo, e.g. using JSFiddle?

from x-frame-bypass.

The-MAZZTer avatar The-MAZZTer commented on June 19, 2024

Set a breakpoint in the constructor of the x-frame-bypass class. Chances are it is not being instantiated and you are looking at a normal iframe.

I think this is because the Angular HTML templates get converted to real HTML differently enough that custom elements that use the is attribute don't get created; they use the base element instead, so you are seeing a normal iframe.

My workaround for this was to inject the raw HTML for the iframe so Angular wasn't responsible for creating it.

My example:

HTML template:

<aside #aside>
</aside>

TypeScript:

    @ViewChild("aside", {static: true}) private aside: ElementRef<HTMLElement>;

private async showAside(): Promise<void> {
    this.aside.nativeElement.innerHTML =
    `<iframe is="x-frame-bypass" allow="fullscreen 'none'; geolocation 'none'; camera 'none'; microphone 'none'" sandbox="allow-scripts"></iframe>`;
    this.aside.nativeElement.getElementsByTagName("iframe")[0].src = URL_HERE; // Doing it this way so I don't have to worry about escaping the url by hand. There's no issue with embedding it directly in the innerHTML.
}

Angular claims it has support for custom elements but that might only extend to ones that don't inherit from an existing element, not sure.

from x-frame-bypass.

The-MAZZTer avatar The-MAZZTer commented on June 19, 2024

@niutech I made my own demo, it's in the linked angular bug report. Pretty sure this is an angular bug.

from x-frame-bypass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.