I'm not really good with javascript and need help with a problem. I've creating a pop-up window that goes to another site but sends the url it's coming from in the url it's going to.
Ok here's what I have if that's confusing.
Now that above code works fine in most cases and on most sites. The problem is that one forum I've tried it on has vbseo which means the php comand $_SERVER[REQUEST_URI] isn't the same that's in the address bar. Instead of showingHTML Code:<head> <script type="text/javascript"> function popupwin(url) { var width = 650; var height = 250; var left = (screen.width - width)/2; var top = (screen.height - height)/2; var params = 'width='+width+', height='+height; params += ', top='+top+', left='+left; params += ', scrollbars=1'; newwin=window.open(url,'popupwin', params); if (window.focus) {newwin.focus()} return false; } </script> </head> <body> <a href="javascript: void(0)" onClick="popupwin('http://example.com/check.php?id=http://$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI]'); return false;">Centered popup window</a> </body>
it's showingCode:http://example.com/check.php?id=http://sitename.com/forum/main-forum/1-test-post-title-some-list.html
After Googling I know that document.write(location.href) will give me the exact url of the seo url as it appears in the address bar which may help. Can anyone show me how to combine document.write(location.href) with my code or offer a suitable alternative to fix the problem?Code:http://example.com/check.php?id=http://sitename.com/forum/showthread.php?p=1
To clarify the above code works on a regular vb forum just not when vbseo is added.
Thanks in advance.



LinkBack URL
About LinkBacks





Reply With Quote