Open Bug 1481847 Opened 7 years ago Updated 3 years ago

Support openInReaderMode in tabs.update

Categories

(WebExtensions :: General, enhancement, P5)

enhancement

Tracking

(Not tracked)

People

(Reporter: ianbicking, Unassigned)

Details

The browser.tabs.create API supports the openInReaderMode parameter. It seems sensible that browser.tabs.update support the same parameter. Unlike updating a URL then calling toggleReaderMode, openInReaderMode puts the user directly into reader mode without flashing the original content in the tab.
toggleReaderMode does exactly what the browser does when you toggle reader mode on a page, so I really don't understand what you're trying to do. If you just want update because the flashing, move this bug to firefox. I get a flash when toggling via the toolbar on a NYT article, so I'm inclined towards this being a reader mode bug.
Summary: Support openInReaderMode in tabs.update → content flashes when toggling reader mode
I want to simultaneously navigate an existing tab (using tabs.update), while also navigating it to a reader mode
I should probably give a bit of context about what I'm trying to accomplish: I would like to intercept some navigations and turn them directly into a Reader Mode view. I've tried a couple approaches: browser.webRequest.onBeforeRequest.addListener((event) => { if (shouldRedirectToReaderMode(event.url)) { // Approach 1; doesn't work because I am not allowed to redirect to an about: URL: let redirectUrl = `about:reader?url=${encodeURIComponent(url)}`; return {redirectUrl}; // Approach 2; doesn't work either because there's no openInReaderMode: setTimeout(() => { browser.tabs.update(event.tabId, {url: event.url, openInReaderMode: true}); }); return {cancel: true}; } return {}; }, {urls: ["http://*/*", "https://*/*"], types: ["main_frame"]}, ["blocking"]);
Set component.
Component: Untriaged → Request Handling
Component: Request Handling → General
Priority: -- → P5
Summary: content flashes when toggling reader mode → Support openInReaderMode in tabs.update
For anyone interested, here is a WebExtension experiment API to accomplish this: https://github.com/ianb/sticky-reader-mode/blob/15d821e6e262fa48a6f65b87c5ba12720a79e302/addon/experiment/api.js
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.