Window.location change or using iframe

Hi there,
After writing some basic React code in my plug-in and saw it renders successfully, I was trying to execute the following render methods, but neither of them worked - in both cases XD got stuck and I had to force quit from the activity monitor.

Can someone clarify if that’s the expected behaviour? If not - how can I either render an Iframe or change the window’s location? Thanks in advance :slight_smile:

render() {
   console.log("option 1")
   window.location = "";

render() {
   console.log("option 2")
   return (
      <div style={{ width: 300 }}>
         <iframe src=""></iframe>
1 Like

First of all: Welcome to the forums :wave::slightly_smiling_face:

The thing is that UXP (XD’s platform for plugins) isn’t a browser and a lot of browser features aren’t fully supported. Among them are <iframe>'s and window locations.

Therefore, solutions depend on what you’re trying to do. If you want to include a fully functional “normal” web page, that’ll probably be difficult for now. If you need a screenshot of the website (like some other plugins), you could use an online service and then show the image. Simple information could be fetched using fetch() and then displayed. It really depends.

A feature request for embeddable web views (which you could vote for) is Embedded webview.

I hope this helps (although it’s probably not the answer you were hoping for),
Happy Coding,