drawcode / jquery-oembed

Automatically exported from code.google.com/p/jquery-oembed
0 stars 0 forks source link

Embedding non-linked URLs #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

            $(document).ready(function() {
                    $("#container").oembed();
            });

...

<div id="container">http://www.flickr.com/photos/14516334@N00/345009210/</div>

What is the expected output? What do you see instead?

No embedding occurs. All of the examples show linked URLs, not just plain URLs. 
My use case is 
that non-linked URLs will appear randomly in text inside a named div. Are 
linked URLs required, 
or am I missing an option?  

Thanks.

Original issue reported on code.google.com by scotfhac...@gmail.com on 28 May 2010 at 12:20

GoogleCodeExporter commented 9 years ago
To put it another way... other oembed tools I've used, such as django-oembed, 
work *only* on plain URLs, not on 
links. Why is jquery-oembed structured around replacing links rather than URLs? 
In what use case would that be 
preferable? Or again, if it already is possible, we could use an example 
showing how. 

Original comment by scotfhac...@gmail.com on 29 May 2010 at 4:34

GoogleCodeExporter commented 9 years ago
If the URL is the only contents of #container, then you could use jQuery to 
pass the URL into the oembed() function:

            $(document).ready(function() {
                    $("#container").oembed($("#container").text());
            });

However, if #container contained more than just the URL, you'd have to do some 
text parsing to pull out just the URL. Using the method above, though, you 
could get your URL's from anywhere in your HTML--attributes, contents, etc.

Original comment by bigbluehat on 25 Jun 2010 at 1:23

GoogleCodeExporter commented 9 years ago
The solution proposed by bigblue works fine.

Original comment by rchamo...@gmail.com on 1 Apr 2011 at 6:07