espfutbol98
New Member
- Messages
- 200
- Reaction score
- 2
- Points
- 0
Could someone please inform me on how this script I found works. I found it on a login page that pops-up and once authenticated, closes and refreshes the page. I'm not sure exactly what it says or how to change it to not use ?sec or &sec but rather just normal page names.
Code:
<script language="javascript">
function CloseAndReturn(sectionID){
if (window.opener)
{
var url=window.opener.location.href;
if (url.indexOf("sec=")>-1)
{
var firstpart;
var middlepart;
var lastpart="";
firstpart=url.substring(0,url.indexOf("sec="));
middlepart=url.substring(url.indexOf("sec="));
if (middlepart.indexOf("&")>-1)
lastpart=middlepart.substring(middlepart.indexOf("&"));
window.opener.location.href=firstpart + "sec=" + sectionID + lastpart;
}
else
{
if (url.indexOf("?")==-1)
window.opener.location.href=url + "?sec=" + sectionID;
else
window.opener.location.href=url + "&sec=" + sectionID;
}
window.close();
}
}
</script>