oz-image-in-editor-obsidian icon indicating copy to clipboard operation
oz-image-in-editor-obsidian copied to clipboard

Feasibility of specifying a custom User Agent for iframe embeds

Open SimplGy opened this issue 3 years ago • 2 comments
trafficstars

Might be nice to be able to set the UA for iframe embeds. My use case would be to set it to a mobile UA so that websites render in a more small-size friendly, content-forward way. It could also be useful for setting a robot/crawler UA to skip modals and other JS interrupts on some websites.

I see there's an abstraction for doing the CustomHtmlDecoration, wasn't sure how well that would play with throwing some script into the frame every time.

Do you think this FR is this generally interesting for your plugin or a little too niche?

SimplGy avatar Sep 24 '22 21:09 SimplGy

Example, before:

image

Mockup, after (changed UA):

image

SimplGy avatar Sep 24 '22 21:09 SimplGy

Noting that when I was playing around with this, I got a lot of "Blocked a frame with origin "app://obsidian.md" from accessing a cross-origin frame" -- reaching in and swapping the UA from the outside might not be feasible. iframes support specifying a CSP but I'm not sure if that's enough to support this.

SimplGy avatar Sep 24 '22 21:09 SimplGy