UniversalViewer / universalviewer

A community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎
http://universalviewer.io
Other
499 stars 192 forks source link

Spike: investigate embed options #88

Closed tomcrane closed 8 years ago

tomcrane commented 9 years ago

investigate better embed scenarios

edsilv commented 9 years ago

An oembed provider could be added to universalviewer.azurewebsites.net using the "rich" type.

The response html could look like:

{
    "version": "1.0",
    "type": "rich",
    "provider_name": "UniversalViewer",
    "provider_url": "http://universalviewer.azurewebsites.net/",
    "width": 800,
    "height": 600,
    "title": "The story of the Wellcome Foundation Ltd",
    "html": "<iframe src="http://universalviewer.azurewebsites.net/uv-1.2.13/app.html?oembed=true&amp;manifestUri=http%3A%2F%2Fwellcomelibrary.org%2Fiiif%2Fb16659090%2Fmanifest" allowfullscreen scrolling="no" frameborder="0" style="width: 800px; height: 600px;"></iframe>"
}

The UV could use https://brad.is/coding/BigScreen/ for full screen instead of sending a message to the parent page to resize the iframe.

"pro" users can still use embed.js with easyxdm (BL, Wellcome, etc) if they're embedding on their own domain and want to communicate with the parent page.

The downside to oembed is that blogging platforms (oembed consumers) would need to add the UV site to a whitelist:

https://codex.wordpress.org/Embeds

Perhaps an interim solution is to use an iframe without embed.js. App.js would then inspect the querystring to check for easyxdm params. If none are found it knows it's a socket-less iframe embed and uses bigscreen etc as if it were using oembed. This would be a way to try out whether oembed would work without needing to implement a provider.

edsilv commented 8 years ago

Create iframe embed for external (not Wellcome Library) embeds?

<iframe src="http://wellcomelibrary.org/spas/uv/app.html?isHomeDomain=true&isOnlyInstance=true&manifestUri=http%3A%2F%2Fwellcomelibrary.org%2Fiiif%2Fb18035723%2Fmanifest&embedScriptUri=http://localhost:8001/src/lib/embed.js&embedDomain=localhost&domain=localhost&isLightbox=false&locale=en-GB&xdm_e=http%3A%2F%2Flocalhost%3A8001%2Fexamples%2F&xdm_c=default8800&xdm_p=4"></iframe>

Would mean you lose tracking for remote domains.

tomcrane commented 8 years ago

Also consider a WordPress plugin, Drupal module etc for more control for those who want it.

tomcrane commented 8 years ago

Problem: iFrame on its own cannot report back the embed domain. Or can it? Is there any way to inject a script to do this? Probably not but need to rule it out.

Is it more important that a user can embed but the origin institution loses the embed domain tracking, or that it is embedded as much as possible?

tomcrane commented 8 years ago

Summary of requirements from @jennpb:

Options discussed [on call]:

As I understand it, the tradeoff is that if we enable embeds through an iframe, we will lose tracking detail in GA.

Ultimately, the solution:

mialondon commented 8 years ago

@tomcrane what are the time implications?

jennpb commented 8 years ago

@mialondon I've asked to timebox a half day of this for investigation, not implementation.

edsilv commented 8 years ago

https://drive.google.com/open?id=1LtQATL7LrJsOLI1Hl_m53gDSDgRmTAdqYiH3Usto4vc