Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming The Internet

PayPal Builds 'Zoid' JavaScript Library To 'Make IFrames Cool Again' (medium.com) 85

"Earlier this year I gave a talk at FullStack conference in London about making iFrames cool again," writes a lead engineer at PayPal. In a nutshell: iframes let you build user experiences into embeddable 'cross-domain components', which let users interact with other sites without being redirected. There are a metric ton of awesome uses for that other than tracking and advertizing. Nothing else comes close for this purpose; and as a result, I feel we're not using iframes to their full potential.

There are big problems, though... My talk went into how at PayPal, we built Zoid to solve some of the major problems with iframes and popups:

- Pre-render to avoid the perception of slow rendering

- Automatically resize frames to fit child content

- Automatically resize frames to fit child content

- Pass down any kind of data and functions/callbacks as props (just like React), and avoid the nightmare of cross-domain messaging between windows.

- Make iframes and popups feel like first class (cross-domain) components.

Zoid goes a long way. But there are certain problems a mere javascript library can not solve. This is my bucket list for browser vendors, to make iframes more of a first class citizen on the web... Because fundamentally: the idea of cross-domain embeddable components is actually pretty useful once you start talking about shareable user experiences, rather than just user-tracking and advertizing which are obviously pills nobody enjoys swallowing.

He acknowledges that he "really likes" the work that's been done on Google Chrome's Portals (which he earlier described as "like iframes, but better, and worse.")

"I just hope iframes don't get left behind."
This discussion has been archived. No new comments can be posted.

PayPal Builds 'Zoid' JavaScript Library To 'Make IFrames Cool Again'

Comments Filter:
  • Ajax? (Score:5, Insightful)

    by johnsie ( 1158363 ) on Monday August 19, 2019 @03:38AM (#59101272)
    Doesn't Ajax do away with the need for iframes? You take the exact data that you need from wherever and can display it in a container.
    • I don't think any modern browser will let you make an Ajax call to a third party site from you own frame. That's a cross-site security threat. You need a dedicated iframe for that like the ones google recaptcha and what not use.

      On a funny note, from TFS:

      ...
      -Automatically resize frames to fit child content
      - Automatically resize frames to fit child content ...

      Since they make sure to resize frames to fit child content twice, what could possibly go wrong?

      • Re: (Score:3, Insightful)

        by war4peace ( 1628283 )

        They recursively automatically resize frames to fit child content.
        ..They recursively automatically resize frames to fit child content.
        ....They recursively automatically resize frames to fit child content.

        • They recursively automatically resize frames to fit child content. ..They recursively automatically resize frames to fit child content. ....They recursively automatically resize frames to fit child content.

          ...until you are lost in a maze of twisty little frames, all alike.

      • Re: (Score:3, Informative)

        by mrbester ( 200927 )

        That's what postMessage is for. But, thanks to Microsoft (and now in all browsers), you can only post to a document in a child, not a document in a different tab or window. Plus you have all the needing to serialise objects or differing varieties of copying (no byRef passing) that doesn't guarantee that what you receive is what you sent, same with (Service) Workers. So there's localStorage for that. But, thanks to Private Browsing it doesn't work consistently, if at all, and you still have to serialise obje

        • by Nkwe ( 604125 )

          It's almost as if the original idea of web pages was that they were separate entities and they fight tooth and nail against attempts at multi-document integration...

          It's almost as if the original idea of web pages was to display static content and not to try to be an application running in a browser.

          • It's almost as if the original idea of web pages was that they were separate entities and they fight tooth and nail against attempts at multi-document integration...

            It's almost as if the original idea of web pages was to display static content and not to try to be an application running in a browser.

            It's almost as if motorized vehicles were meant to transport people and not to ship boxes of arbitrary goods.

            The web is useful as a collection of static pages but 10 million times more useful with the ability to run an application in a browser. Like Slashdot, for example. Or a shopping cart or weather report or chat rooms or even pointerpointer.com [pointerpointer.com].

            • by suutar ( 1860506 )

              Certainly it's more useful this way. But the fact that the original design didn't take a lot of the current needs into account is part of why we have so many layers of features fixing holes and/or performance issues from other features.

              • Certainly it's more useful this way. But the fact that the original design didn't take a lot of the current needs into account...

                I agree; it's hard to prophesize, especially about the future.

                Like a lot of things, the internet became far more of a thing than anyone imagined. Tim Berners-Lee was a visionary, but even visionaries can only see so far. (Another factor is a lot of the technology that the web uses now didn't exist when it was first created.)

                I've said this before, but when I started out in computers (1980) the very idea that you would someday own an entire gigabyte of mass storage was ludicrously silly. It was like thinking

          • That WAS the original Idea. Today your browser is a thin client to network based applications.

            Why did this happen?
            1. During the late 1990's and early 2000's everyone new how to browse a webpage, but running that application was scary. Put the application on the web page, then people just automatically didn't fret about using it.

            2. Lack of standardization withing graphical terminal emulators. X-Terminals were often more expensive then the standard PC, RIP Script was kinda popular, but it stayed in Specia

      • What? You must be confused. Sites do that all the time. That's the entire point of CORS headers.

      • -Automatically resize frames to fit child content - Automatically resize frames to fit child content ...

        Since they make sure to resize frames to fit child content twice, what could possibly go wrong?

        I'm not sure children should be using paypal.

      • by Cito ( 1725214 )

        -Automatically resize frames to fit child content.

        First mobile games, mobile apps, then triple a games on console and pc... Now they wanna give web browsers automatically resizing loot boxes? Argh!

        Hehe

    • by agm ( 467017 )

      That depends on your requirements. Iframes can be useful for PCI compliance where you don't want any credit card information to go anywhere near your site. Where I live hosted payment pages are the common workaround for this. An issue with this is those that are not used to hosted payment pages may trust them less, and they don't offer as much flexibility to keep the popup "in brand".

      • If the payment page is contained within another page, how do I confirm my transaction is safe? I.E. if you're on a "safe" page, you get a lock icon in the address bar, and if you have EV SSL cert, you get a nice big reassuring green bar. How does that display in an i-frame?
      • Not true, the data form containing the credit card information simply has to be submitted directly to the payment processor to avoid having sensitive data handled by your server, and thus greatly simplify PCI requirements. This does not require that the form be presented in an iframe.

    • by zifn4b ( 1040588 )

      Doesn't Ajax do away with the need for iframes? You take the exact data that you need from wherever and can display it in a container.

      No. AJAX is making an HTTP request within Javascript usually to some type of service that can serve data to be rendered like a REST service. iframes are for the situation when the other site doesn't expose this sufficiently enough to do what you're suggesting so you embed the other site within your application. It depends on the situation.

      • Correct, but the AJAX call can be a loader that returns HTML code to inject into the current web page.
        • True as long as the AJAX call is back to the originating domain, otherwise you have to open the security blanket to allow the call across sites..
          • by zifn4b ( 1040588 )

            Correct, but the AJAX call can be a loader that returns HTML code to inject into the current web page.

            True as long as the AJAX call is back to the originating domain, otherwise you have to open the security blanket to allow the call across sites..

            Obviously, neither of you understand web tech from jQuery onward. Whether the XMLHttpRequest returns HTML or some other format like JSON or XML, you manipulate the DOM in JavaScript utilizing that information. JavaScript is unaware of the payload to do a security check as far as I know. The only security checks that I'm aware of in that situation is CORS [wikipedia.org]. Only legacy websites and services don't support pre-flight checks. CORS allows you to control what domains are allowed to call you. So, yes, using C

            • by tepples ( 727027 )

              The <iframe> element allows some measure of browser-mediated sandboxing so that you don't have to negotiate with the server operator to open CORS to your domain.

            • by Viol8 ( 599362 )

              "web tech"

              Hahahaha, web tech, thats funny :) Web "throw a load of bad ideas into a bucket of slop called javascript and stir" you mean.

              • by zifn4b ( 1040588 )
                Yep it's funny... every single time my paycheck gets deposited. Absolutely hilarious.
                • Yep it's funny ... every single time my paycheck gets deposited. Absolutely hilarious.

                  Congratulations. You have, at minimum, demonstrated the social wherewithal of conning the greater fool, though it remains unclear whether you break this chain of greater fool-hood when your paycheck gets spent.

                  ———

                  The fundamental DNA of web technology was implanted during the dotcom boom. Those of us who were there at the time tend have tended to regard web technology as a cesspool of the greater fool ever

                  • by zifn4b ( 1040588 )
                    You do realize people have been griping about languages since the 1980's right? It has been nothing but argumentation that never reaches a conclusion. Who is more foolish, the person who incessantly argues and fights a pointless battle or the person who realizes it's just a carousel and gets off the ride and lives a happy life realizing they can't control everything not even one bit?
                • by Viol8 ( 599362 )

                  Maybe one day you'll learn real progamming and get an even bigger paycheque.

              • by ceoyoyo ( 59147 )

                To a web developer, technology is figuring out how to do something in spite of the rickety edifice that is web development.

            • Obviously, you must be very infatuated about yourself (and much less smart than you think) to make such assumptions
    • Doesn't Ajax do away with the need for iframes?

      There is no need for iframes, except if you load a while page different from a different domain and/or security reasons.

    • How come when I ask a perfectly reasonable question like this, I only get a question like "FUCK OFF AND DIE, FAGGOT!"
      • How come when I ask a perfectly reasonable question like this, I only get a question like "FUCK OFF AND DIE, FAGGOT!"

        Because there are a significant number of people who are basically just idiots with poor impulse control (IPIC).

        IPICs are everywhere- you'll find them in stores, schools, bus stops, parties, movie theaters, beaches, bars, restaurants, offices, parking lots, prisons, at the 7-11, the DMV, and of course, on the internet. Hell, you could probably climb to the top of Mt Everest and find one waiting for you.

        Maybe it's always been this way but it seems to me as if it's more of a problem now.

    • Re:Ajax? (Score:5, Informative)

      by coofercat ( 719737 ) on Monday August 19, 2019 @08:01AM (#59101594) Homepage Journal

      I wrote a simple email tool which loads the body of the message in an iframe. The reasons for doing so are:

      1) The body is (sort of) user supplied data. It's washed when we receive it, so it won't be dangerous per-se, but it might have images too wide for the space or whatever.
      2) The inserted content is of unknown size, so the iframe scales it correctly and assigns scroll bars as necessary (yes, you can do with with ajax/css, but it's much harder work)
      3) There's really no need for Javascript just to render a page on the screen

      Once you accept Javascript, then yes, Ajax does this quite nicely (with a good chunk of HTML sanitisation and lots of CSS to keep it contained in your page). However, you can do it with or without javascript very nicely with an iframe.

      In the case of paypal, if they do the same as other payments people where you do the payments flow inside an iframe, then actually a lot of my points apply - Ajax isn't an option, and the HTML you're including is beyond your control, and so you need to be careful with it (accidental scroll bars are better than a fully broken page). Whether any of this makes iframes "cool" is an entirely different question though ;-)

    • Comment removed based on user account deletion
    • Didn't people start moving away from frames when SBC started filing patent infringement claims against them?

  • Let them die (Score:2, Insightful)

    by Anonymous Coward
    Let this shit die please. iframes brought about so many security and exploit nightmares. we do not need to make them popular again.
    • Re: (Score:2, Interesting)

      iframes are the current way used to segregate code from different domains in order to prevent cross-site scripting exploits or at least, this is the theory. Otherwise, you have to basically reverse-proxy everything which is my preferate way to go so sites don't look like they load stuff from a zillion domains. Short from reverse-proxying everything or using iframes, what solution do you suggest?

    • How does that differ from JavaScript?
  • Does it automatically resize frames to fit child content?
    • by Mashiki ( 184564 )

      No. But it'll send small gnomes to your house to break your fingers so it can never be properly sized a child frame anyway. Sometimes bad ideas are just bad.

    • I also need to know if it will automatically resize frames to fit child content. Can we get an editor to clarify if it will automatically resize frames to fit child content, or not?

    • Does it automatically resize frames to fit child content?

      It looks like it does it twice just to make sure.

  • Privacy (Score:5, Insightful)

    by mrwireless ( 1056688 ) on Monday August 19, 2019 @04:30AM (#59101326)

    This sounds like an attempt to get around the gains in privacy control in the browser. Not allowed to load in third party cookies? Just load in an entire third party website instead.

    • Comment removed based on user account deletion
      • by olau ( 314197 )

        Some browsers block cookies in iframes from other sites completely. I think Safari started that.

        And yes, that practice makes it difficult to embed legitimate content from other sites. All because of the likes of ad agencies, Facebook and similar.

  • Paypal like all other megabusinesses cannot have a wholesome motive. This begs the question of their real motives and Slashdot is an ideal place to ask.
    Why do they want this?
    What are possible privacy implications?
    What are possible security implications?

    • by Entrope ( 68843 )

      Citizen, there are a "metric ton of awesome uses for that other than tracking and advertising [sic]". Do not ask for specifics, as they automatically resize frames to fit child content. The content is obviously "user experiences, rather than just user-tracking and advertising". If tracking and advertising and automatically raising frames to fit child content are important enough to mention twice, why would you think they might want to use iframes for tracking and advertising?

      • by Entrope ( 68843 )

        Argh, stupid keyboard "fixing" typos in cut-and-paste segments. "tracking and advertizing [sic]"

    • iframes are for "shareable user experiences".

      I want to pay and go. No "shareable user experiences" there.

    • I would imagine that they primarily want to make their service more appealing to vendors, and one way of doing that is to make it easier and more seamless. Right now you leave the vendor's site to make a payment, then get sent back to it. What if they just load payment into an iframe? That better gives the appearance of being all one site.

    • Language changes, but "begs the question" is almost never what you really meant to say. It now means what you meant, but you're reusing idioms instead of communicating clearly. Communicate clearly. English has far too many options in syntax and grammar, making it rich and rewarding when you find the right combination of words. But a minefield if you don't study it.

      Boom you died, stepped on a mine.

  • then it's wrong.

  • Yeah, its a web dev in full bullshit flow.

    And who spells advertiSing with a Z ffs?

  • iframes were always cool!

  • by Martin S. ( 98249 ) on Monday August 19, 2019 @06:40AM (#59101420) Journal

    I do a lot of automated testing with Selenium WebDriver and testing iframed sites is an absolute nightmare in comparison to HTML 5 markup.

  • HTML standards (Score:5, Informative)

    by chthon ( 580889 ) on Monday August 19, 2019 @06:57AM (#59101458) Journal

    In HTML5 iframes are "allowed". So I suppose that in a next HTML standard iteration they might get obsolete.

    • The concept of iframes will never disappear. The functionality is valid and has real purposes.

      The specific tag might evolve into something else, sure, but even then, I doubt <iframe /> will disappear then, at least not in the next 5 years.

    • I'm surprised they were incorporated into HTML5 at all.
    • Re: (Score:2, Interesting)

      by Anonymous Coward

      Unlike previous versions, HTML5 isn't a static specification though. They could deprecate iframes in the "evolving" standard.

      I'd like to kill HTML5 and go back to an SGML compliant language, even better if XHTML could come back but I know that's widely hated.

  • I have iframes permanently disabled. Seems not to affect much (nothing I care about anyway). Been like this since, oh, I don't know, they were invented?

  • - Automatically resize frames to fit child content

    - Automatically resize frames to fit child content

  • Jeebus, why won't IFRAMEs die already?

    Typically an IFRAME represents a poor architectural decision, either to:

    • Not do a proper integration, or...
    • Chase someone else's bullshit code or site as it changes out from under you.

    Seriously, if a dev says "Oh! We can do it with an IFRAME!", run far and fast.

    >>>>> a real tear...because of IFRAMEs <<<<<<.

    • Is it a fundamental issue with a design that uses a frame or viewport?
      Does the way IFRAME work sucks, and with changes it could be better?
      Are web developers misusing an otherwise useful functionality, is the correct application of this tool not being communicated correctly to the industry?

      I get that in terms of layout it sucks. If I slice up my website to fit on an 800x600 display (when IFRAMEs were last relevant), and the underlying content changes layout. Well now I have to deal with a bunch of scrollable

      • In both cases, it's a punt down the road, to avoid doing the _real_ work well.

        In the former (decision not to perform a good integration), the devs choose not to make the system do intelligent work for the user, but instead say "we'll just put up whatever's on the screen and let the other system sort it out".

        Certainly this is a decision that bad budgeting forces on developers - so often not their fault directly. But businesses need to learn to take "no you can't do that with that little money" for an answer,

    • I'm not aware that there is another way to incorporate another web site int your web page ... please enlighten me how you would do that without an iframe.

      • From front-end code exclusively, an IFRAME is pretty much it.

        (I'm assuming you could write a screen-scraper in JavaScript, but that'd be a long way to go, and you might have to deal with cross-site scripting limitations, etc).

        Where I see a lot of surrender to the expediency of IFRAME awfulness is in corporate software development.

        A variety of server-side frameworks and portal software offer capabilities to integrate enterprise systems (i.e put payroll, HR, email, room-reservation, etc. systems on your intra

        • Portlets never where a big thing.
          I guess 10 years ago everyone was all about "mashups", but they are today not a big thing either.

  • I loved my Zoid! You wound it up and it slowly rolled/stomped its way across a flat surface. It only had one window, but it was cool for a short time.
  • I had my menu on the left (in an iframe) and a big honkin title graphic up top (yep, iframe!) and the menu buttons would load content into the 50% of the 640 x 480 that was left... which, you guessed it, was an iframe. Web 1.0 was pretty much Napoleon Dynamite.
    • by martinX ( 672498 )

      Yep. Good times. iFrames could solve all sorts of problems, but they introduced so many more. Accessibility was a nightmare. Weird scrollbars in weird places. Page title. What happens if your menu is too long for the screen it's on...

  • There are a metric ton of awesome uses for that other than tracking and advertizing.

    True, but this is what the overwhelming majority of them WILL be used for.

And it should be the law: If you use the word `paradigm' without knowing what the dictionary says it means, you go to jail. No exceptions. -- David Jones

Working...