Hi there.
Im using a great script to grab info from the url like ?title=My%20Title
this is working great until i share the page on facebook then it comes back like: ?title=My+Title when clicked via Facebook. This is a problem because the title now reads My+Title instead of my Title as it should.
heres what i Got:
The Script that seperates the segmants in the url:
Code:
<script type="text/javascript">
var qs = [ ];
if ( location.search.length > 1 )
{
var pairs = location.search.substring(1).split("&");
for ( var p = 0; p < pairs.length; ++p )
{
var pair = pairs[p].split("=");
qs[pair[0]] = unescape( pair[1] );
}
}
var title = ""+ qs["title"] +"" ;
var date = ""+ qs["date"] +"" ;
var channel = ""+ qs["channel"] +"" ;
var info = ""+ qs["info"] +"" ;
var image = ""+ qs["image"] +"" ;
var stream = ""+ qs["stream"] +"" ;
// do the replacements *after* page is loaded, for simplicity:
function doReplacements( )
{
var link = document.getElementById("link1");
link.href = url;
link.innerHTML = qs["page"];
}
window.onload = doReplacements;
</script>
An example of how i use the info:
Code:
<script type="text/javascript">
document.write(''+info+'');
</script>
This part shares the unique url on Facebook and allows me to have just one page with many URLS for facebok sharing and commenting:
Code:
<fb:comments href="<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>" num_posts="4" width="620"></fb:comments>
So what i need to do is be able to either deal with or change the + that comes back from facebook.
Thank You