Skip to content

rel=noopener for <form> and <base> elements #2983

Closed

Description

@ondras

The rel=noopener is currently available only for <a> and <area> elements. I suggest adding this attribute-value pair also to:

  • <form> element, as it is well possible to have a <form target=_blank> which creates the window.opener binding in the newly created context (tested in Firefox 55);
  • <base> element, which can be already used to specify a target=_blank globally for all links. Having a way to make all these links noopener would be consistent with the current <base> usage.

Activity

  1. annevk commented on Aug 30, 2017

    @annevk
    Member
  2. added
    topic: navigation
    on Aug 30, 2017
  3. mystor commented on Aug 30, 2017

    @mystor
    Contributor

    Adding noopener to the <form> element seems like a relatively straightforward improvement, though it does open up the question of what other rel attributes should be exposed there.

    My first concern about the <base> element would be that a page which had set <base rel="noopener"> would have no way to specify a link as one which is not noopener. I'm not sure if that's a use case which we want/need to support however.

    I'm also curious about <base>'s interaction with window.open, if you write window.open("https://google.com") in a <base rel="noopener"> page, for example, one might expect the newly opener window to not have window.opener set, and for window.open to return null.

  4. annevk commented on Aug 30, 2017

    @annevk
    Member

    It wouldn't work for window.open(). We don't use <base target> values there either.

  5. ondras commented on Aug 30, 2017

    @ondras
    Author

    what other rel attributes should be exposed there.

    Would it be possible to start with just the noopener and add others if that becomes a thing?

    My first concern about the element would be that a page which had set would have no way to specify a link as one which is not noopener.

    Good catch. Perhaps an opener value might be usable to override?

    I'm not sure if that's a use case which we want/need to support however.

    Our services use a pop-up login window facility that depends on .opener to work at all, so I think this use case is relevant.

  6. annevk commented on Aug 31, 2017

    @annevk
    Member

    Other than noopener and noreferrer, are there any values that would have an actual impact? I guess with <base> the problem might be how it affects <link>? That does indeed seem rather unfortunate.

  7. added
    addition/proposal
    needs implementer interest
    on Feb 5, 2018
  8. gcbw commented on Jun 13, 2018

    @gcbw

    <base> support is a nobrainer. The original gecko feature ticket people even wonders why not add noopener by default with opt-out instead https://bugzilla.mozilla.org/show_bug.cgi?id=1222516#c4

    This will help when well behaved ads, for example, using regular <a> links to compromised landing pages. Won't help much if the actual ad is compromised though.

  9. added
    topic: frames/navigables/browsing contexts
    and removed
    topic: navigation
    on Jan 23, 2019
  10. annevk commented on Jan 24, 2019

    @annevk
    Member

    Mozilla would like to add rel support to <form>. In particular to enable non-auxiliary top-level browsing context creation.

    @cdumez is this something Apple would like to do as well? @tkent-google @creis Google?

    (<base> is too involved as it would also have to impact <link>, which creates a mess.)

  11. cdumez commented on Jan 24, 2019

    @cdumez

    Yes, I support adding rel to form.

  12. added
    needs concrete proposal
    and removed
    needs implementer interest
    on Jan 24, 2019
  13. 1 remaining item

  14. tkent-google commented on Jan 25, 2019

    @tkent-google
    Contributor

    This is a reasonable change.

  15. added
    impacts documentation
    on Jan 25, 2019
  16. sideshowbarker commented on Jan 25, 2019

    @sideshowbarker
    Member

    I strongly support adding noopener behavior to form but I think rel is the wrong syntax for adding it.

    I propose that for form we instead add a new boolean noopener attribute.

    The fact that we previously made the bad design choice of using rel for noopener behavior for the a element shouldn’t be used as a precedent. It was a mistake to use rel for noopener behavior to begin with, and we shouldn’t now further propagate that mistake.

  17. mikewest commented on Jan 25, 2019

    @mikewest
    Member

    I think adding the functionality is pretty reasonable. I don't have strong opinions about how exactly we spell it: rel or a boolean attribute both seem fine to me.

    On the other hand, I'm not at all enthusiastic about extending <base>. If folks want the ability to set a default policy for a page or site, I hope we can align on some out-of-band mechanism instead (origin policy or feature policy seem like good targets).

  18. annevk commented on Jan 25, 2019

    @annevk
    Member

    @sideshowbarker I don't know about that. For #4078 Safari is shipping opener as value and Firefox is following. I suspect we want that on <form> if we do the _blank defaulting on <form> as well. We might also want to support noreferrer here if we keep its semantics as a strict superset of noopener. Given that, rel seems like the obvious choice, also because <form> basically is <a> in terms of behavior (it navigates).

  19. sideshowbarker commented on Jan 25, 2019

    @sideshowbarker
    Member

    For #4078 Safari is shipping opener as value and Firefox is following.

    Yeah, I guess it’s a lost cause if we keep getting stuck with changes to the HTML language happening in way that preempts any opportunity for web developers and the wider community to ever have a chance to weigh in on what would be the preferred way to hook the feature into the language.

    It seems to me we generally don’t end up with the best designs for the long term when one browser project “experiments” with unilaterally making some change to the language that they decide on their own is the most convenient hook for hanging some new UA behavioral change on — and then another browser project goes ahead and implements it. What we end up with instead is technical debt.

    What we’ve been doing with rel for this stuff is pretty clearly not what rel was originally intended for — what its semantics were before we started shoehorning things like this into it. But like I said, I guess it’s a lost cause now since we’ve already ended up polluting rel to the point where its semantics are that it’s now just a general extension point for declaratively controlling a (growingly disparate) range of browser behavior.

    I suspect we want that on <form> if we do the _blank defaulting on <form> as well.

    What we want is to associate some behavior with <form>. From that it doesn’t necessarily follow that we want or need to use the same (poorly considered) syntax choice used previously to associate the behavior with a different element.

    In the case of associating behavior with the <a> element I guess the reason chosen to hook this (and other features) into rel was that the <a> element already had a rel attribute. So I guess the rationale was that it was more convenient or easy or whatever to drop it into rel rather than adding a new attribute for it.

    But in this case the form element doesn’t already have a rel attribute. So this change is very different from the <a> change in that it’s adding a whole new attribute to the element that it’s never had before — rather than repurposing or extending some existing attribute it already has. And along with that, it’s going to pull in all the rest of the spec complexity of the Link Types machinery onto form.

    We might also want to support noreferrer here if we keep its semantics as a strict superset of noopener.

    If that happens then it would be better to add the capability to <form> with a new noreferrer boolean attribute instead.

    Given that, rel seems like the obvious choice, also because <form> basically is <a> in terms of behavior (it navigates).

    rel only seems like the obvious choice because of us now being stuck forever with the precedent of having used rel to add it to the <a> element. It’s not at all obvious that using rel to begin with was objectively the right design choice. It’s not written in stone anywhere that we have no choice but to keep on uncritically proliferating that design choice. We’ve imposed it on ourselves. We can choose to un-impose it.

    Anyway I’m resigned to the likelihood that the facts that have been put on the ground here mean that I’m just tilting at windmills on this. But I do hope that in making future decisions we can find a way to avoid ending up imposing further technical debt like this — avoid painting ourselves into a corner the way that’s happened with rel.

  20. annevk commented on Jan 25, 2019

    @annevk
    Member

    Well, this is the first time I've seen someone complain about the way rel is used on <a>. Why didn't this come up when noopener was added on top of noreferrer? And again, I'd like to stress that I think precedent is somewhat important to follow here given how similar in behavior <a> and <form> ultimately are. Using an entirely new syntax will lead to confusion.

    I also think it's not justified to say that the developer community did not get a say on #4078 while OP there obviously has a bunch of support, including from you, and thus far nothing negative in that thread.

  21. added 2 commits that reference this issue on Feb 1, 2019
    e24ca70
    af22fbd
  22. annevk commented on Feb 7, 2019

    @annevk
    Member

    A concrete proposal for this is now at #4332 by the way. It retcons form into a hyperlink (it navigates after all). This seems like the right approach and @sideshowbarker seemed more amenable to it after discussing it further out-of-band. Review appreciated. If someone wants to volunteer for writing tests that'd be even better!

  23. removed
    needs concrete proposal
    on Feb 7, 2019
  24. sideshowbarker commented on Feb 7, 2019

    @sideshowbarker
    Member

    A concrete proposal for this is now at #4332 by the way… This seems like the right approach and @sideshowbarker seemed more amenable to it after discussing it further out-of-band.

    Yes

    It retcons form into a hyperlink (it navigates after all).

    Yeah I think that’s necessary if we’re gonna have rel there

  25. added a commit that references this issue on Feb 14, 2019
    cf483d3
  26. added a commit that references this issue on Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalimpacts documentationtopic: frames/navigables/browsing contexts

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions