Skip to content

Links in embeddable grids should open new browser tab #4214

Description

@jonxuxu

(heavily edited by @jywarren)

Embeds allow embedding of inline grids, and are available when clicking the faint grey link to the bottom right of each grid:

image

The generated iframe uses a URL like: https://publiclab.org/embed/grid/nodes:purpleair

Once embedded on another site, when you click links or buttons, the iframe loads an entire instance of the plots2 website within the iframe. It can be quite cumbersome on the browser and the user could get confused very quickly.

Here's an example of this issue:
ezgif com-video-to-gif 3

Link:
https://store.publiclab.org/collections/featured-kits/products/lego-spectrometer-kit?variant=8187504787563

Solution:

We should ensure all links in the /embed/... views are adjusted to have target="_blank" so they open in a new window/tab. We could do this in JavaScript; we'd have to detect the controller action with params[:action] == 'gridsEmbed', because they're run out of:

app/controllers/tag_controller.rb: def gridsEmbed

We'll want to only do this in the embed view, but not for normal inline grids code. The templates are in:

https://github.com/publiclab/plots2/tree/master/app/views/grids/

Any help appreciated!!!

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions