I am working on an audio player that has a popout function. I couldn’t think of any way to pass the information to the resulting popout window but passing them as GET variables through the URL.
as a result, I end up with a javascript link more or less like:
<div id="audio-player-popout" onclick="window.open('http://popout-url/index.php?file=Filename.mp3&title=Title",'audioplayer','location=0,menubar=0,status=0,scrollbars=0,width=350,height=450');">
The problem is that when the title contains an apostrophe, it shows up as
’
rather than an apostrophe. I am using php’s addslashes but it doesn’t seem to make a difference. Without addslashes, it causes an error with the javascript obviously.
Is there a better way to go about this or what am I doing wrong?
Thank you!
Use
urlencodeon the title.From the PHP Manual: