Get url parameters and redirect to specific url with javascript -
how can redirect specific url appear in url parameter?
example:
http://www.mywebsite.com/code_id.tv/stream.php
i want code_id , redirect specific url.
the result url this:
http://www.mynewwebsite.com/tv.php?id=code_id
thanks
to split path code_id:
var url2process = window.location.pathname; var patharray = url2process.split( '/' ); // remove '.tv' or '.movie' or '.whatever' end var code_id_array = patharray[1].split('.'); var code_id = code_id_array[0]; // redirect window.location = 'http://domain.com/rb/play.php?id=tt' + code_id;
Comments
Post a Comment