Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Page Applications #129

Open
tutley opened this issue Feb 5, 2016 · 2 comments
Open

Single Page Applications #129

tutley opened this issue Feb 5, 2016 · 2 comments

Comments

@tutley
Copy link
Contributor

tutley commented Feb 5, 2016

I believe there should be a way for single page applications to dynamically provide their oembed endpoint to the outside world.

For instance, if you are using Angular, Ember, etc, the HTML that a server receives when it requests say, and article: http://singlepageapp.com/articles/this-cool-article - It's just going to be the application layout with static, or meaningless META and LINK tags in the header. You can change those tags dynamically so they render in the user's browser, but that's not going to appear for any sort of scraper or programmatic discovery.

It seems like since the requesting agent already knows the URL that it's trying to get to, you should simply need to include this in your header:

<link rel="alternate" type="application/json+oembed" href="http://singlepageapp.com/api/article/oembed" title="singlepageapp oembed endpoint" />

The spec lays out the parameters, and the requester already knows the URL they want (or they wouldn't have been able to get to the page in the first place) so I'm confused as to why each page needs to include its URL in the provider discovery.

@tutley
Copy link
Contributor Author

tutley commented Feb 7, 2016

So, I found a way to work around this on the server side: when a requestor comes into the site with a direct link, the server can parse the string and figure out if it is a request to a client-side route that displays a sharable resource. If so, the server-side template can inject the relevant oembed links into the header.

@spacemunkay
Copy link

For simple single page apps without a pre-render server, it'd be nice to just specify the oembed endpoint without the parameters and allow the consumer to pass along the url for the page they're requesting.

So I'm curious as well to know why it's necessary to have the requested url in the provider discovery.

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

No branches or pull requests

2 participants