Project

General

Profile

Bug #393

1. instagram not showing

Added by David Bryan almost 7 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Immediate
Assignee:
Category:
-
Start date:
09/19/2019
Due date:
% Done:

0%

Estimated time:

Description

https://www.familyfriendlyhq.ie/family-moments/stories/family-moments-nicola-carolan-9254/
db has tested re adding the block, but not rendering out the front
linked to FB

#1

Updated by Pierce Gleeson almost 7 years ago

  • Assignee changed from Pierce Gleeson to David Bryan

(First off, issue is no longer immediate priority as we're not gating any articles of significance yet, but still needs to be fixed)

This happens because we are using an embed in a Gated Article, because a Gated Article content is rendered in javascript once you are logged in. You can easily replicate the bug by embedding an instagram in any gated article.

This is as a result of a javascript issue with the way third party embeds work. I'd expect us to have some issues with FB, wufoo, anything else that writes out a <script src> tag inline in the code

We're writing out our content in JS, so the instagram embed.js file is being written too late to work.

Running this in the console updates the Instagram embed and the image, etc appears:

function addScript( src ) {
  var s = document.createElement( 'script' );
  s.setAttribute( 'src', src );
  document.body.appendChild( s );
}

addScript('//www.instagram.com/embed.js');

I can see ways to add external JS in your Vue components here:
https://stackoverflow.com/questions/45047126/how-to-add-external-js-scripts-to-vuejs-components
https://medium.com/@gaute.meek/how-to-add-a-script-tag-in-a-vue-component-34f57b2fe9bd

My problem with this is that we can maybe embed Instagram's js but we'd be doing it for every post. AND it doesn't take account of all the other embeds we might want to do (Facebook, Wufoo, whatever).

So possibly we'd have to scan the content for all linked <script src> files, and then embed each of them! A regex scan? A big job. Would like Newton's advice/help on this as it's getting complicated.

-P

Also available in: Atom PDF