0

i am trying to read variables from my url and pass them into flowplayer. for example if my link is: "http://someurl/flowplayer.html?video=mymovie.mp4&time=180"

i want to create the video src link using the video varaible and time variable. I tried using javascript, but i am getting error.

hamza h
  • 355
  • 1
  • 4
  • 12

1 Answers1

0

I use this function to read params from url in JavaScript:

function getParam( sParamName ){
  sLocation = location.href;
  aLCQS = sLocation.split("?");
  if (aLCQS.length > 1){ // there are a querystring
    aParams = aLCQS[1].split("&");
    for( f=0; f<aParams.length; f++ ){
      aParam = aParams[f].split("=");
      if( aParam[0] == sParamName ){
        return aParam[1]; // return the value
      }
    }
  }
}

how to use:

video=getParam("video");
time=getParam("time");
// do what you want..
markus
  • 561
  • 4
  • 15
  • 1
    thanks for that bit of code. it works great. I got the rest of what i needed to do from here http://stackoverflow.com/questions/12151606/setattribute-and-video-src-for-changing-video-tag-source-not-working-in-ie9 – hamza h Jan 30 '13 at 15:38