MrFoh
MrFoh

Reputation: 2701

Parsing links,youtube links from text

Am working on a project that allows users to posts status updates etc. I am trying to figure out a way to parse links posted by a user from their status updates, and display them as clickable links and possibly thumbnails of the web pages they point to like facebook. I was also wondering if its better to this server side with php or client side with javascript. Thanks for the help

Upvotes: 1

Views: 155

Answers (2)

SenorPuerco
SenorPuerco

Reputation: 911

It depends on how important this is to your project. If this is something that needs to happen on every page no matter if the user has javascript disabled, then you should use PHP. If this is a eye candy thing and you don't care if a few percent of your visitors don't see it, then you could consider javascript, because that will allow the page to load fully without the additional code. Then, once the page is loaded, you can parse through with javascript. It would also lessen the load on your servers a bit.

From your short description, it seems like PHP is the way to go. As far as the way to do it, you'll need to have a more specific question if you want a useful answer.

Upvotes: 1

PiKey
PiKey

Reputation: 678

I think that's better to let detect that links by PHP, anybody can disable javascript on his browser.

Upvotes: 0

Related Questions