0
Corrigé

Viewport not working for Chromium 46.0.2490.71 on Linux

BG - Ben Armstrong il y a 8 ans mis à jour par JJ Jewell il y a 8 ans 8

None of the Viewport presets work for me on Chromium 46 in Debian sid on the Cinnamon desktop, and also at home on a similar system with LXDE. Whenever I select a Viewport preset, it always reports:


Viewport resizing doesn't work on special browser pages, such as the "New tab", "Downloads", "Settings" pages and so on.


If this is not the case, please reload the page and try again.


However, no tabs are open to special browser pages. The problem is reproducible with a single tab open to the site I'm developing.


I've had to change them all to Window for now, but that's inaccurate for the platforms they're supposed to represent.


For comparison, I tested on my Windows 7 VM with Chrome 46.0.2490.80 on Virtualbox. The Viewport presets work fine there.


Solution

Solution
Corrigé

Hi Ben,


I found out what it was (kinda).

First of all, this problem manifests itself only on Chromium, not on the official Google Chrome. I suggest you switch to Google Chrome to make sure you're always using the latest & greatest, stable, enterprise grade version of the browser instead of a community built package.


The extension calls chrome.tabs.captureVisibleTab to take a screenshot of the current tab (see why at the end). By default, the tab is captured as JPEG, but for some reason (maybe missing codecs or JPEG licensing and Open Source mumbo-jumbo - don't know, don't care) that method fails on Chromium with the error message "Failed to capture tab: encoding failed".

Anyway, I explicitly set the format to PNG and all seems to be working now. I have published an updated version on the Webstore that should be available in the next hour.


Q: What do you need a screenshot for?

A: The Chrome extensions' API provides no way to re-size the viewport, just the window. In order to set a custom size for the viewport, I must determine the size of the window's borders which, added to the desired viewport size, determine the overall size the window must have, but there isn't an API for that either. So, I'm taking a screenshot of the current tab, subtract that from the actual size of the window and I find out what size the borders are.



Best Regards,


Ionuț

À l'étude

Is the page you're working on loaded via the http:// or the file:/// protocol?

If it's file, please make sure you allowed the extension access to file URLs.

It is http:. Any other ideas?

Sorry, no idea on what it could be... I'll install Debian inside a VM and see what happens. (in a day or two)


Regards,

Ionuț

OK. I confirmed this also on Debian "jessie" 8.2, the latest Debian stable release, using chromium 46.0.2490.71-1~deb8u1. So just install that.

Solution
Corrigé

Hi Ben,


I found out what it was (kinda).

First of all, this problem manifests itself only on Chromium, not on the official Google Chrome. I suggest you switch to Google Chrome to make sure you're always using the latest & greatest, stable, enterprise grade version of the browser instead of a community built package.


The extension calls chrome.tabs.captureVisibleTab to take a screenshot of the current tab (see why at the end). By default, the tab is captured as JPEG, but for some reason (maybe missing codecs or JPEG licensing and Open Source mumbo-jumbo - don't know, don't care) that method fails on Chromium with the error message "Failed to capture tab: encoding failed".

Anyway, I explicitly set the format to PNG and all seems to be working now. I have published an updated version on the Webstore that should be available in the next hour.


Q: What do you need a screenshot for?

A: The Chrome extensions' API provides no way to re-size the viewport, just the window. In order to set a custom size for the viewport, I must determine the size of the window's borders which, added to the desired viewport size, determine the overall size the window must have, but there isn't an API for that either. So, I'm taking a screenshot of the current tab, subtract that from the actual size of the window and I find out what size the borders are.



Best Regards,


Ionuț

Thanks! Works perfectly.

yes it is, i just wont to thank you guys for the input, its an eye opener when i readiing along ,not aware that some may be watching at 4am. any i thank you guys for the info.

bob reynolds

just trying to find out why i can't load yahoo it keeps saying resolving hosts anyone know what is going on?