Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve issues with window.open / anchor target rewriting #94

Closed
ikreymer opened this issue Sep 27, 2022 · 0 comments · Fixed by #97
Closed

Resolve issues with window.open / anchor target rewriting #94

ikreymer opened this issue Sep 27, 2022 · 0 comments · Fixed by #97

Comments

@ikreymer
Copy link
Member

ikreymer commented Sep 27, 2022

Currently, there is no special handling for <a target=...> and window.open(..., target) values, which affect where the URL will be loaded.

In the case of window.open(), the url is rewritten without the mp_ modifier, causing it to open the top-frame in framed replay.
However, window.open(url, "_self") can result in the URL opening in the same window, so need to keep the mp_ modifier.

Also, opening in new window / tab can cause unexpected behavior if replaying in an embedded mode (eg. replayweb.page embed).

Additionally, _parent, and _top, can mess with the top-frame that contains the banner, which replayed pages should not access.

The ideal behavior is to navigate within the top iframe itself, which can be given a specified named (in pywb / wabac.js).
The name can be provided via wbinfo inject.

Plan to resolve as follows, for both anchor tag and window.open:

  • If wbinfo.target_frame is provided, replace any of _parent, _top, _blank with that value, to ensure navigation happens with top frame.
  • If target is any other value, keep as is.. (Unfortunately, no way to tell if a named 'browsing context' exists or not, so could still result in opening in a new window, or replacing an existing iframe?)
  • Always rewrite with mp_, to load the replay. This may result in banner not being shown if somehow a new window is open due to named context.

Other option is to also replace named context with _self as well, thereby disallowing any other name, but that could break replay in some edge cases. (How often are named contexts used?)

For anchor tag rewriting, fix will likely involve pywb and wabac.js changes as well, while window.open() override can be handled here.

ikreymer added a commit that referenced this issue Oct 1, 2022
…get="..."> and window.open(..., target) to the specified named target,

if set on the outer <iframe>
fixes #94
ikreymer added a commit that referenced this issue Oct 2, 2022
…get="..."> and window.open(..., target) to the specified named target,

if set on the outer <iframe>
fixes #94

bump to 3.3.9
@ikreymer ikreymer mentioned this issue Oct 2, 2022
ikreymer added a commit to webrecorder/wabac.js that referenced this issue Oct 2, 2022
ikreymer added a commit to webrecorder/replayweb.page that referenced this issue Oct 2, 2022
- support target rewriting with named iframe as per webrecorder/wombat#94
- refactor sw init: detect additional errors, such as CORS issues in nested iframes
- support cross-origin replaybase for embeds
- add 'requirecrossoriginiframe' to restrict embed to only be loaded in subdomain iframes, otherwise showing
- rename noSandbox -> sandbox, not enabled by default

docs: add example embed to docs

bump to 1.7.0-beta.1
ikreymer added a commit that referenced this issue Oct 2, 2022
…get="..."> and window.open(..., target) to the specified named target, (#97)

if set on the outer <iframe>
fixes #94

bump to 3.3.9
ikreymer added a commit to webrecorder/wabac.js that referenced this issue Oct 3, 2022
…ead (#84)

* target rewrite: 
- support rewriting of target in <a target> and window.open(..., target) as per webrecorder/wombat#94
- use named top frame (___wb_replay_top_frame), set in wbinfo.target_rewrite for wombat
- prevent anchor links / window.open() from opening in new windows
- tests: update test to include target rewrite 
- dependencies: bump to wombat 3.3.9
ikreymer added a commit to webrecorder/replayweb.page that referenced this issue Oct 4, 2022
…tter error messages (#126)

* embeds:
- support target rewriting with named iframe as per webrecorder/wombat#94
- refactor sw init: detect additional errors, such as CORS issues in nested iframes
- support cross-origin replaybase for embeds
- add 'requirecrossoriginiframe' to restrict embed to only be loaded in subdomain iframes, otherwise showing
- rename noSandbox -> sandbox, not enabled by default

init: set appName on service worker init
docs:
- add example embed to embedding doc
- update docs for noSandbox -> sandbox
- add warning if deprecated 'noSandbox' flag is used, explaining that it is now deprecated
- update embedding and CHANGES.md with latest features
- add tweet-example.wacz
- add embed.html to test embeds

bump to 1.7.0-beta.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant