Eliminate redundant redirect through redirect.html

This commit is contained in:
Kijin Sung 2016-02-25 15:11:51 +09:00
parent 4b81e32e22
commit 892aa58540

View file

@ -39,8 +39,9 @@ class VirtualXMLDisplayHandler
}
$html = array();
$html[] = '<script type="text/javascript">';
$html[] = '//<![CDATA[';
$html[] = '<html>';
$html[] = '<head>';
$html[] = '<script>';
if($output->message)
{
@ -49,12 +50,17 @@ class VirtualXMLDisplayHandler
if($output->url)
{
$url = preg_replace('/#(.+)$/', '', $output->url);
$html[] = 'self.location.href = "' . $request_url . 'common/tpl/redirect.html?redirect_url=' . urlencode($url) . '";';
$output->url = preg_replace('/#(.+)$/', '', $output->url);
$html[] = 'if (opener) {';
$html[] = ' opener.location.href = ' . json_encode($output->url) . ';';
$html[] = '} else {';
$html[] = ' parent.location.href = ' . json_encode($output->url) . ';';
$html[] = '}';
}
$html[] = '//]]>';
$html[] = '</script>';
$html[] = '</head><body></body></html>';
return join(PHP_EOL, $html);
}