diff options
author | emkael <emkael@tlen.pl> | 2018-01-30 02:32:14 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-01-30 02:32:14 +0100 |
commit | 98f99725d698fe72090087442a72a5bd17c29fa8 (patch) | |
tree | ffbeddfab638fdb61387de71a9275cfd930eba62 | |
parent | b063e5df09c75d32f88d9c61590f0060037ff43b (diff) |
Replacing <meta> refresh with JS refresh to preserve state (e.g. hash) of the refreshed frame
-rw-r--r-- | tdd-bootstrap.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tdd-bootstrap.php b/tdd-bootstrap.php index 9d7998d..2ed216b 100644 --- a/tdd-bootstrap.php +++ b/tdd-bootstrap.php @@ -65,6 +65,15 @@ class Protocol { $dom->find('/html/body/table/tr', 0)->outertext = ''; } + // replacing meta http-equiv refresh with a javascript refresh to preserve hash in the result page + $meta = $head->find('meta'); + foreach ($meta as $metaTag) { + if ($metaTag->hasAttribute('http-equiv') && strtolower($metaTag->getAttribute('http-equiv')) == 'refresh') { + $head->innertext = str_replace($metaTag->outertext, '', $head->innertext) . '<script type="text/javascript">setTimeout(function() { location.reload(); }, ' . ($metaTag->getAttribute('content') * 1000) . ');</script>'; + break; + } + } + print $dom->outertext; } |