I think it could be useful to detect when content is loaded in an iframe embedded in another page rather than loaded on it’s own in a browser window.
Maybe something along the lines of a CSS :root selector. Would iframe:root make sense or :iframe?
Also I think it would make sense to be able to detect the permissions of an iframe sandbox from within the content.
Currently we can style differently if allow-scripts is not included in the sandbox attribute by adding styles (or content) in <noscript> tags to detect this.
I was hoping to be able to use something like form:disabled form:enabled to detect sandbox="allow-forms" but looks like that’s not valid.
And other sandbox values I’m sure could have some benefits <iframe>: The Inline Frame element - HTML: HyperText Markup Language | MDN
Not sure what the best way to approach this but something similar to the CSS @supports query would make the most sense to me. @function not (script){} could be used instead of <noscript><style></style></noscript>
This may well have use outside of an iframe too.
I’d be interested if people had any thoughts around this