Hello,
i have this code:
echo “<script type=’text/javascript’>openWindow(‘”.$adress.”‘)</script>”;
the $adress send an url with variables like “xpto.com?var=1&varB=2”
Problem is that using window.open always encodes & character to & and the url doesn’t open. I have tried many functions but still doesn’t work.
I have this javascript code:
function convert(str)
{
str = str.replace(/&/g,”&”);
//alert(str);
return str;
}
function openWindow(adress)
{
//document.write(adress);
//endereco = convert(adress);
//unescape(url)
//decodeURI()
//decodeURIComponent()
//html_entity_decode();
//encoded.replace(/&/g, ‘&’);
newwindow=window.open( adress,’PROJECT’,’height=800,width=1000′);
if (window.focus) {newwindow.focus()}
return false;
}
The convert function doesn’t do anything. the commented javascript functions like unescape, etc also doesn’t work. If i do alert(adress) it converts & to & but if i do document.write(adress); it shows correctly. So i assume that some functions encode and others don’t. Meaning that window.open encode by default. It there a way to override this?
Thanks for the attention.