JavaScript-Switcher icon indicating copy to clipboard operation
JavaScript-Switcher copied to clipboard

<input> still hidden if inside <noscript>

Open goozak opened this issue 4 years ago • 1 comments

Given this HTML:

<html>
  <head>
    <title>Working...</title>
  </head>
  <body>
    <form method="POST" name="hiddenform" action="http://dummy">
      <input type="hidden" name="Data" value="SomeData"/>
      <input type="hidden" name="OtherData" value="Coffee"/>
      <noscript>
        <p>Script is disabled. Click Submit to continue.</p>
        <input type="submit" value="Submit"/>
      </noscript>
    </form>
    <script language="javascript">window.setTimeout(alert('Submited via JS'), 0);</script>
  </body>
</html>

When JavaScript is disabled via the Switcher, the <p> tag is shown as expected, but not the <input>. If JavaScript is disabled via javascript.enabled, the entire <noscript> is shown (but only if the Switcher is green).

goozak avatar Jan 26 '21 15:01 goozak

This bug is also prevalent with <style> elements which can break entire websites: Try opening a Startpage search with JS disabled by this addon: The results are invisible (!) because of missing noscript styles.

I normally never recommend copying code, but in this case, I think it's best to just use 100% of uBlocks code for this logic, so replace background/content.js with https://github.com/gorhill/uBlock/blob/2b9aba27489274a42bcc03ae7ac1da3bb33305a9/src/js/scriptlets/noscript-spoof.js and it works fine. This uBlock version also considers xml files and meta refresh inside

phil294 avatar Apr 17 '22 10:04 phil294