Go Back   CodingForums.com > :: Client side development > JavaScript programming > Post a JavaScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-29-2013, 01:38 AM   PM User | #1
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,553
Thanks: 9
Thanked 480 Times in 463 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%

Last edited by rnd me; 03-29-2013 at 11:31 PM..
rnd me is offline   Reply With Quote
Users who have thanked rnd me for this post:
saqisgd (03-29-2013)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:14 AM.


Advertisement
Log in to turn off these ads.