SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    pateldesign
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to hide the Video Url using javascript?

    I have a wordpress blog and am uploading videos to it. I use a wordpress custom field to get the video url.

    <a href="http://mydomain.com/wp-content/uploads/videoname.flv" rel="mediabox[360 272]">Videoname</a>

    So how do I prevent others from getting that video's url so that they aren't able to link to the video from their site (which is stealing bandwidth).

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    This can't be done with client-side javascript, but server-side.
    You could point to a file that authenticates the request and gets and returns the media file.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    pateldesign
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you do it with server-side?

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Which server side language will you be using?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    WordPress - PHP?
    If you put the media files in a folder outside of the root, they can't be accessed by HTTP, but can be accessed by script.
    If you have a link something like
    .....media.php?mediaId=345&amp;uniqueId=g6huo8fd56njgh8i
    then media.php can match the media id to the actual media file and check that the unique id is valid. If it is, then the file can use PHP's file functions to get the media file and return it with the appropriate mime type header().


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •