Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7927871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:32:35+00:00 2026-06-03T19:32:35+00:00

I’m currently implementing a feature to micropost posting where a user can link to

  • 0

I’m currently implementing a feature to micropost posting where a user can link to a website, video, image etc and have info previewed to them before they submit the actual micropost.

I’m using:

Ruby Open graph protocol gem:

https://github.com/intridea/opengraph

Open graph protocol:

http://ogp.me

and I’ve tested it out and it’s very easy to use and works as expected:

Controller:

  require 'opengraph'

  def new
    @movie = OpenGraph.fetch('http://www.youtube.com/watch?v=6ifSudReeuM')
  end

View:

<iframe src="<%= @movie.video %>"></iframe>

This displays the video as expected. Ok, I need to do this without supplying the videos url in the controller manually but allow my users to do so but before submitting a micropost form.

There is a textfield in the micropost form for pasting links.

On pasting of a link or click of a div button inside my micropost form I want to pass the url to the controller and into OpenGraph.fetch() as an argument.

I want to do this without submitting my micropost form, meaning without clicking the main submit button for the form. I realise I can write up some JQuery to detect when the textfield has text pasted into it, then get the value of the text field which is the URL.

Question:

My question is how can I simulate what I’ve done with my current controller.. basically how I’ve manually provided a link as an argument for OpenGraph.fetch() but use the URL pasted/typed in the textfield by the user.

I just want to have my users see a preview of what they’ve pasted, e.g. video screen and description of video which I can grab from the object but before they submit the micropost.

  1. User pastes link
  2. My grabs the info using the open graph protocol gem
  3. Displays it without the page refreshing

Then user can type their micropost content in the text area for the micropost form or just submit it.

All data is sent to the database.. e.g. micropost content and URL to the video.

I can’t seem to figure out a way to implement this. I’d appreciate some help thanks.

Kind regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:32:40+00:00Added an answer on June 3, 2026 at 7:32 pm

    Set up a separate controller action that does nothing but fetch the ogp data for the passed url param, then set up an onpaste event in the frontend on the url input to fire an ajax request to the action, and pass back the data. When the ajax requests receives the response, it can populate the preview as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.