Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make src an optional paramter #6

Closed
wants to merge 1 commit into from

Conversation

brizandrew
Copy link

I'm using this to create a sandboxed iFrame that shouldn't have a src. I've tried to work within the constructor provided, but all the options are conflicting with my ability to inject content into it.

Things I've tried to get around the problem:

  • Not passing a src makes the iframe have src="undefined"
  • Passing it a blank src makes the iframe have src(unknown).
  • Passing it a null src makes the iframe have src="null".

I think the best thing to do is simply not set the attribute if it's not provided to the constructor.

Happy to talk some more about my (admittedly a-typical) use case if you'd like.

I'm using this to create a sandboxed iFrame that shouldn't have a `src`. Not passing a `src` makes the iframe include `src="undefined"`. Passing it a blank `src` makes the iframe include `src(unknown)`. Both these options are conflicting with my ability to inject content into it. I think the best thing to do is simply not set the attribute if it's not provided to the constructor. 

Happy to talk some more about my (admittedly a-typical)  use case  if you'd like.
@rdmurphy
Copy link
Owner

Interesting! No prob making this a thing, but what's the typical use case? I'm aware of srcdoc (which this also doesn't support yet), but are there other paths too?

@brizandrew
Copy link
Author

We’re playing around with being able to run some code in an environment where it’s easy to tear it down (by deleting the iframe) and run it again by running eval from the iFrame’s window.

Not something we’d do in audience-facing content but it’s in the works for one of our new tools.

I got the whole thing working with a standard iframe I made using document.createElement but when I tried doing the same thing with an iFrame that has a src (even if it’s blank) the code stopped working so I realized that’s why this library wasn’t working for me either.

Base automatically changed from master to main March 9, 2021 00:32
@rdmurphy
Copy link
Owner

rdmurphy commented Mar 9, 2021

Hello! 👋 I'm sure y'all long ago moved on from this but did wanna say I have a pretty significant reworking coming that will enable this (and make any attributes you'd like able to be passed).

@brizandrew
Copy link
Author

Pretty sure I'm still using a custom version for this. So would be great to replace that with an official release. Looking forward to the update!

@rdmurphy
Copy link
Owner

rdmurphy commented Jan 4, 2022

This is now going to be possible in 1.0.0! It's still at @newswire/frames@beta, but will likely move to latest later today. 🎉

@rdmurphy rdmurphy closed this Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants