Blog Post 7

Chris Cooper
3 min readJun 16, 2019

--

  1. Describe one thing you learned in class today.

That learning Javascript will prove challenging yet rewarding and I can’t wait to study more about it.

2. Describe the difference between <script>, <script async> and <script defer>.

The <script> tag is used to define a client-side script(JavaScript). The <script> element either contains scripting statements, or it points to an external script file through the src attribute. Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.

The async attribute is a boolean attribute. When present, it specifies that the script will be executed asynchronously as soon as it is available. Note: The async attribute is only for external scripts (and should only be used if the src attribute is present).

The defer attribute is a boolean attribute. When present, it specifies that the script is executed when the page has finished parsing. Note: The defer attribute is only for external scripts (should only be used if the src attribute is present).

3. What are data- attributes good for?

The data-attributes gives us the ability to embed custom data attributes on all HTML elements. The stored (custom) data can then be used in the page’s JavaScript to create a more engaging user experience (without any Ajax calls or server-side database queries). … The attribute value can be any string.

4. Describe the difference between a cookie, sessionStorage, and localStorage.

LocalStorage:

Web storage can be viewed simplistically as an improvement on cookies, providing much greater storage capacity. Available size is 5MB which considerably more space to work with than a typical 4KB cookie.

The data is not sent back to the server for every HTTP request (HTML, images, JavaScript, CSS, etc) — reducing the amount of traffic between client and server.

The data stored in localStorage persists until explicitly deleted. Changes made are saved and available for all current and future visits to the site.

It works on same-origin policy. So, data stored will only be available on the same origin.

Cookies:

We can set the expiration time for each cookie

The 4K limit is for the entire cookie, including name, value, expiry date, etc. To support most browsers, keep the name under 4000 bytes, and the overall cookie size under 4093 bytes.

The data is sent back to the server for every HTTP request (HTML, images, JavaScript, CSS, etc) — increasing the amount of traffic between client and server.

sessionStorage:

It is similar to localStorage.

Changes are only available per window (or tab in browsers like Chrome and Firefox). Changes made are saved and available for the current page, as well as future visits to the site on the same window. Once the window is closed, the storage is deleted

The data is available only inside the window/tab in which it was set.

The data is not persistent i.e. it will be lost once the window/tab is closed. Like localStorage, it works on same-origin policy. So, data stored will only be available on the same origin.

5. What kind of things must you be wary of when design or developing for multilingual sites?

How will users be directed to their native language?

Text In Images Won’t Scale.

Restrictive Word / Sentence length.

Be Mindful of How Colors Are Perceived Across Different Cultures.

Completely remove text content from templates.

Formatting Dates.

6. How do you serve a page with content in multiple languages?

Choosing the right language to serve.

Providing language info for the current page.

Optimizing for SEO.

Setting language explicitly.

Guessing language preference.

--

--

Chris Cooper
Chris Cooper

Written by Chris Cooper

An avid learner, writer, and creator that seeks to bring out the best in himself and others : )

No responses yet