mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
Rewrite: Support target rewriting, open new windows in top-frame instead (#767)
* Bump wombat to 3.3.9 * Set target attributes to iframe name
This commit is contained in:
parent
98378a8845
commit
815ea92fc2
@ -433,6 +433,12 @@ class HTMLRewriterMixin(StreamingRewriter):
|
||||
# URL not skipped, likely src='js/....', forcing abs to make sure, cause PHP MIME(JS) === HTML
|
||||
attr_value = self._rewrite_url(attr_value, rw_mod, True)
|
||||
self._write_attr('__wb_orig_src', ov, empty_attr=None)
|
||||
|
||||
elif attr_name == 'target':
|
||||
target = attr_value
|
||||
if target in ('_blank', '_parent', '_top'):
|
||||
attr_value = '___wb_replay_top_frame'
|
||||
|
||||
else:
|
||||
# rewrite url using tag handler
|
||||
rw_mod = handler.get(attr_name)
|
||||
|
@ -416,6 +416,9 @@ r"""
|
||||
>>> parse('<!--[if !IE]> --><html><![endif]--><a href="http://example.com/"><!--[if IE]><![endif]--><a href="http://example.com/"></html>')
|
||||
<!--[if !IE]> --><html><![endif]><a href="/web/20131226101010/http://example.com/"><!--[if IE]><![endif]--><a href="/web/20131226101010/http://example.com/"></html>
|
||||
|
||||
# Test tag with a target
|
||||
>>> parse('<HTML><A Href=\"page.html\" target=\"_blank\">Text</a></hTmL>')
|
||||
<html><a href="page.html" target="___wb_replay_top_frame">Text</a></html>
|
||||
|
||||
# Test blank
|
||||
>>> parse('')
|
||||
|
@ -65,6 +65,8 @@ ContentFrame.prototype.init_iframe = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
this.iframe.setAttribute("name", "___wb_replay_top_frame");
|
||||
|
||||
this.extract_prefix();
|
||||
if (window.WBBanner) {
|
||||
this.wbBanner = window.WBBanner;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -27,6 +27,7 @@
|
||||
wbinfo.proxy_magic = "{{ env.pywb_proxy_magic }}";
|
||||
wbinfo.static_prefix = "{{ static_prefix }}/";
|
||||
wbinfo.enable_auto_fetch = {{ config.enable_auto_fetch | tobool }};
|
||||
wbinfo.target_frame = "___wb_replay_top_frame";
|
||||
</script>
|
||||
{% if env.pywb_proxy_magic %}
|
||||
{% set whichWombat = 'wombatProxyMode.js' %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user