• 0 Posts
  • 2 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle
  • Be careful though; the code actually loads a different script that’s been posted by a Wikipedia user, not Wikipedia itself. You can view the script here, and do heed the warning at the top:

    Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with “importScript”, “mw.loader.load”, “iusc”, or “lusc”, take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.

    Never run/execute code that you haven’t verified yourself. Also, keep in mind that while the code might be trusted now, because you’re including code from a wikipedia page that might be changed at any one moment, you can’t be sure the page won’t serve you malware tomorrow. So instead of using the code above, it’s safer to use the code below (which is just a copy-paste of the actual script, and therefore can not be changed by other people):

    /*
      Force Wikipedia to use the desktop version.
      Google on mobile uses "en.m.wikipedia.org", this scripts redirects to the normal version.
      
      CC0
    */
    if(window.location.href.match(/^https?:\/\/[^.]+\.m\./)) {
      var desktopUrl = $('#mw-mf-display-toggle').attr('href')
      if(desktopUrl) {
      	window.location.href = desktopUrl
      }
    }