Skip to content

Conversation

georgestagg
Copy link
Collaborator

@georgestagg georgestagg commented Nov 16, 2023

Fixes posit-dev/r-shinylive#28

I saw someone ask for this recently, the idea being that the query parameters in a shinylive.io URL should be forwarded and accessible to the inner Shiny app running in the iframe on the page.

I am unsure if we actually would want this behaviour or not, I could be convinced either way. But in any case, the implementation is simple (grab the parameters from the outer page URL and append to the iframe's src attribute) so I have placed the change here for discussion.

Also includes some formatting changes from prettier, apologies for the noise.

  • Add enable/disable option for passing URL parameters - default to off?
  • Consider how this feature interacts with runApp().

Also includes some formatting fixes from prettier.
@georgestagg georgestagg marked this pull request as draft November 20, 2023 15:29
@schloerke
Copy link
Collaborator

schloerke commented Nov 30, 2023

** Updates description to link issue if this PR was merged.

Should we also include the hash?

Closing #84 in favor of this PR

@georgestagg
Copy link
Collaborator Author

georgestagg commented Dec 1, 2023

Should we also include the hash?

I think so, yes. It makes sense to me that if the query parameters are passed through, the hash part should be too.


@wch and I did have a short discussion about this. IIRC the main question is how this kind of behaviour should be handled when shinylive is used as part of a larger context such as a Quarto doc. In that case, there could be multiple apps embedded into the same page, and Quarto might also be using the query and fragment parts of the URL for its own devices. Should those be passed through? Probably not.

A quick solution is to make this optional, we could pass some flag through runApp() to turn it on. #65 proposes changing the schema of the runApp() app options argument and if that goes ahead we should also be able to add a new passUrlParams switch fairly easily, with a default of false.

@seanbirchall
Copy link

@georgestagg any update here I've been eagerly waiting for this PR to merge.

@georgestagg
Copy link
Collaborator Author

georgestagg commented Jul 13, 2024

Whoops! Re-opened. Apologies for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

url_search parsing a shinylive app

3 participants