8000 `javascript:` ban disallows legitimate use for bookmarklets · Issue #165 · elm/virtual-dom · GitHub
[go: up one dir, main page]

Skip to content

javascript: ban disallows legitimate use for bookmarklets #165

Open

Description

@Janiczek

See Janiczek/ellies#3

I want to create a bookmarklet, which means an <a href="javascript:...">link</a> that I can drag to my bookmarks tab and there click on it to perform some JS on any page I'm on.

Elm's VDOM disallows this so the best I could do is to link to a file on GitHub that contains the bookmark source code.

Activity

  1. jackwilsdon commented on Feb 21, 2020

    @jackwilsdon

    It's still possible to have a javascript: link using Html.Attributes.property, although this seems like more of a workaround than a solution:

    module Main exposing (main)
    
    import Html exposing (Html, a, text)
    import Html.Attributes exposing (property)
    import Json.Encode as E
    
    
    main : Html msg
    main =
        a [ property "href" (E.string "javascript:alert(\"This works!\")") ] [ text "Click me" ]

    Ellie link

  2. Janiczek commented on May 5, 2022

    @Janiczek
    Author

    Note this workaround doesn't work with --optimize builds.

  3. laurentpayot commented on May 6, 2022

    @laurentpayot

    Note this workaround doesn't work with --optimize builds.

    Unfortunately this is true and makes this nice workaround useless 😞

  4. Janiczek commented on May 16, 2022

    @Janiczek
    Author

    virtual-dom has recently been fixed; this now doesn't work in non-optimized builds either.

    Here is a way to have bookmarklets in Elm via WebComponents: https://ellie-app.com/hwbBHmqLQ8Ra1

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0