{"id":99,"date":"2018-01-16T07:00:00","date_gmt":"2018-01-16T14:00:00","guid":{"rendered":"https:\/\/coreassistance.com\/tips\/?p=99"},"modified":"2018-01-13T14:24:17","modified_gmt":"2018-01-13T21:24:17","slug":"dont-trust-client-side-javascript","status":"publish","type":"post","link":"https:\/\/coreassistance.com\/tips\/2018\/01\/16\/dont-trust-client-side-javascript\/","title":{"rendered":"Don&#8217;t Trust Client-Side JavaScript"},"content":{"rendered":"<p>It&#8217;s important to remember that the JavaScript embeded or attached to your website is going to be run inside a web browser you don&#8217;t control, which is running on a computer you don&#8217;t control.  Your code can be disabled or altered by various browser extensions, configurations, and developer tools.<\/p>\n<p>Most of the time your code will run just fine, but you can&#8217;t count on it.  Make sure your site works well even if JavaScript is disabled, and don&#8217;t use client-side JavaScript for anything critical.<\/p>\n<p>The most common mistake made with trusting client-side JavaScript is relying on it to validate form input.  It&#8217;s a great idea to give people a better experience by letting them know about issues before they even submit a form using JavaScript, but you have to remember that JavaScript may never even be executed.  Data validation and sanitation must be done on the server side regardless.<\/p>\n<p>Note that this tip only applies to client-side JavaScript running in the web browsers of your visitors, not JavaScript (or other code) running on your server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why client-side code should never be trusted for anything critical.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":7,"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/posts\/99\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coreassistance.com\/tips\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}