Skip to content

Fixing the browser rendering issue for chrome and chromium browsers #3029

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/python/plotly/plotly/io/_base_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,11 @@ def open_html_in_browser(html, using=None, new=0, autoraise=True):
if isinstance(html, six.string_types):
html = html.encode("utf8")

if isinstance(using, tuple):
using = [i for i in webbrowser._browsers.keys() if any(j in i for j in using)]
if using:
using = using[0]

class OneShotRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
Expand Down
7 changes: 4 additions & 3 deletions packages/python/plotly/plotly/io/_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,10 @@ def show(fig, renderer=None, validate=True, **kwargs):

# External
renderers["browser"] = BrowserRenderer(config=config)
renderers["firefox"] = BrowserRenderer(config=config, using="firefox")
renderers["chrome"] = BrowserRenderer(config=config, using="chrome")
renderers["chromium"] = BrowserRenderer(config=config, using="chromium")
renderers["firefox"] = BrowserRenderer(config=config, using=("firefox"))
renderers["chrome"] = BrowserRenderer(config=config, using=("chrome", "google-chrome"))
renderers["chromium"] = BrowserRenderer(config=config, using=("chromium", "chromium-browser"))
renderers["opera"] = BrowserRenderer(config=config, using=("opera"))
renderers["iframe"] = IFrameRenderer(config=config, include_plotlyjs=True)
renderers["iframe_connected"] = IFrameRenderer(config=config, include_plotlyjs="cdn")
renderers["sphinx_gallery"] = SphinxGalleryHtmlRenderer()
Expand Down