Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,188
    Thanks
    10
    Thanked 569 Times in 550 Posts

    easy javascript-disabled preview

    graceful degradation is nice, but how do we make sure our pages work on all devices when javascript is disabled?

    you can turn JavaScript on and off in most browsers, but it's rarely simple to do so just for a quick test in the middle of your development work.

    using HTML5's new sandbag attribute for the iframe, we can view a site without javascript using an iframe.

    i boiled this down to a handy bookmarklet that can do this for the current site:

    Code:
    <a href="javascript:location.href='http://danml.com/nojs/#'+encodeURIComponent(location.href);"
    >nojs</a>
    EDIT: you can use this link to a page hosting the bookmarklet to make it easier to "install".
    if you've never used one, just go to the page linked above and drag the only link there to your bookmarks toolbar. installed. click while viewing any site to enter no-js mode...

    simple, can be used on mobile devices, and it respects your privacy.

    Note: a site can prevent this from working by sending a special HTTP header. This is not supposed to be used to view sites you are not building. If you want to make sure it works, don't send the "X-Frame-Options" header.

    Note2: yes, this does link to my site, but because it uses the hash, bookmarklets leave no referrer, the site being framed will not appear in my log. i have no idea what it's being used for, nor can i tell even if i wanted to, which i don't.

    feel free to download the simple html shell and serve it on your own to alleviate lingering fears.
    Last edited by rnd me; 03-29-2013 at 11:31 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  2. Users who have thanked rnd me for this post:

    saqisgd (03-29-2013)


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •