question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the ability to apply properties to the iframe

See original GitHub issue

Hi, I have just started to use your library to help with the Payment Request API and for this the allowpaymentrequest property needs to be set on the iframe.

Is there a way to introduce a way of setting these properties as part the the connectToChild method?

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
loganvolkerscommented, Mar 21, 2018

👎 for the @killix approach.

I think that having both an appendTo and iframe option leads to a conflated API and data flow.

  • Create an iframe
  • Create a holder that the iframe will be appended to
  • Put both of them in the library
  • The iframe ends up in the holder

If you do change the API, I’d recommend a functional callback approach that also addresses some of the appendTo use cases in a minimal but powerful API.

const connection = Penpal.connectToChild({
  appendTo: (iframe) =>{
         var element = document.getElementById("foo");
         iframe.setAttribute('allowpaymentrequest','');
         iframe.style.position = "absolute";
         element.appendChild(iframe);
  }
   ...
});

I think the above approach would let people solve many of the “I need to do something with the iframe”, would have a minimal API, and would solve any timing concerns with iframes being unable to be modified before they’re appended to the DOM (e.g. for styling).

For reference we had to use the appendTo option with some class selectors like #foo iframe.

0reactions
killixcommented, Apr 4, 2018

Basically, all cases when the creation/management of the iframe is managed by a component framework style (Vue, React).

Read more comments on GitHub >

github_iconTop Results From Across the Web

<iframe>: The Inline Frame element - HTML - MDN Web Docs
Applies extra restrictions to the content in the frame. The value of the attribute can either be empty to apply all restrictions, or...
Read more >
How to apply CSS property to an iframe ? - GeeksforGeeks
Approach 1: There are several techniques to apply CSS property to an iframe, as given below. We can use inline CSS for the...
Read more >
Add an iframe to a model-driven app main form - Microsoft Learn
In this article · Expand Data, select Tables, open the table that you want, and then select Forms from the Data experiences area....
Read more >
The ultimate guide to iframes - LogRocket Blog
Note: By default, the iframe element has a border around it. To remove it, you can use the style attribute to set the...
Read more >
How to apply CSS to iframe? - html - Stack Overflow
An iframe is universally handled like a different HTML page by most browsers. If you want to apply the same stylesheet ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found