Embed web page within post
-
@Codejet You'd embed a webpage using an iFrame, which you'd need to create a plugin for (assuming there's not one already), but DO NOT allow normal members to post iFrames. All it takes is one person to iframe a webpage containing an auto downloading exe virus or something and you've got a recipe for bad things to happen.
-
You would run into a problem with iframes, most medium-large sites block iframe requests completely.
-
Thanks for the information. Good to know
Hmm sounds like its excluded from default markdown syntax because, most likely these reasons.
I was sifting through Markdown tutorials all I could find is [[embed ]] and [youtube] type embed in the default markdown. Nothing that used embed to embed html's. Noticed this thing called oembed , looked quite powerful, yet completely confusing to a lame brain like me.
The only real issue I have with embed.ly is that it takes ages to update, refresh a card (if its in you category you see code for 3-4 seconds before it updates to a card. That and it updates every single url in your NodeBB
Also noticed unless you land on a page with the embed.ly card embeded, up until then you will only see code not the card on every page.
-
Managed to change embed.ly's core to actually iframe embed an entire web page.
Question with regards to iframe's and auto width's and height's
Does Nobebb have any such variables/properties to use maybe within ?<script>
I can auto size the width using width="100%" or wdith:100%
height is proving difficult
also with content.replace(oldcode, withnew) how can you make sure the user is uid=admin or which ever
being that the above poster mentioned don't let normal users use this shortcode/plugin
maybe someone could help me with an if(uid=0) {} somewhere just after the content.match
-
Do you want the iframe to automatically adjust to the height of the contents? If so, this is only possible either if you get the site's html with an ajax request or if the site's url meets the same origin policy.
-
@pitaj said:
Do you want the iframe to automatically adjust to the height of the contents? If so, this is only possible either if you get the site's html with an ajax request or if the site's url meets the same origin policy.
Yeah. Would be good. I was thinking maybe you already have some sort of code in the core already for setting dimensions say with use with iphone and ipad.
What sort of Ajax request would take the given url and be able to store those settings in the request. Then use them in the width and height dimensions in the iframe code.
(function(module) { "use strict"; var EmbedWebPage = {}, embed = '<iframe id="iFrame" src="$1" style="width: 100%;border:0;" width="100%" height="3000" frameBorder="0" scrolling="no"></iframe>'; var embedcode = /<a href="(.+)">.+<\/a>/g; EmbedWebPage.parse = function(data, callback) { if (!data || !data.postData || !data.postData.content) { return callback(null, data); } if (data.postData.content.match(embedcode)) { data.postData.content = data.postData.content.replace(embedcode, embed); } callback(null, data); }; module.exports = EmbedWebPage; }(module));
I would like to trigger the embed without using direct url's, my regexp is not great though
-
var EmbedWikipedia = {}, embed = '<iframe id="iFrame" height="3000" frameBorder="0" scrolling="no" style="width: 100%;border:0" width="100%" src="https://en.wikipedia.org/wiki/$1"></iframe>'; var embedcode = /<a href="(?:https:\/\/)?(?:en\.)?(?:wikipedia\.org)\/(?:wiki\/)?(.+)<\/a>/g;
use https:// for embedding wikipedia pages, http:// for making them links .. woohoo