How to disable Evernote web view "max-width" with JavaScript?

3716 views javascript
5

Evernote places a max-width limit on web view content, and I have identified its location in Chrome developer tool(F12). Evidence: Unticking the checkbox beside "max-width" will stretch the table to full window width.

My question is, how can I remove that css statement with JavaScript code?

I have tried this:

document.getElementById("container").style.removeProperty("max-width")

but in vain.

Evernote web view sample

The above web page can be reached at http://www.evernote.com/l/ABXYD6q6bM9MyaAfRs78hQnq6VMINfVJODg/

answered question

2 Answers

13

Not sure how webview works, but could you try using javascript to add a new class to it that added a max-width of 100%?

document.getElementById("container").classList.add('no-max-width');

then in the styles.css put

.no-max-width { max-width: 100%; }

If that's not possible, then try

document.getElementById("container").style.maxWidth('100%');

Though I sometimes have trouble with .styles so not sure if that is exactly right, plus I've read it's better to add classes rather than play with css styles in JS, but also not sure how accurate that is.

posted this
0

Given that this statement isn't set as inline style, you won't be able to remove it.
However, you could change its value and set it to none by adding an inline style declaration, which will override the current value.

Demo:

var elem = document.getElementById('container');
elem.style.maxWidth = 'none';

posted this

Have an answer?

JD

Please login first before posting an answer.