ALL
How to play with cross domain request
What is cross domain requestIn simple, cross domain request is to request resource from other domain in one domain. Note, the "other domain" doesn't just mean domain name only, it includes much more. If the protocol, domain name, port is not the same, two domains will be considered different. Below example describes what is considered as different domain.http://www.a.com/a.jshttp://www.a.com/b.js # Same domainhttp://www.a.com/lab/a.js # Same domainhttp://www.a.com/script/b.js # Same domainhttp://www...
11,290 0 FRONT END JSONP CROSS DOMAIN CROSS ORIGIN CORS DOCUMENT.DOMAIN WINDOW.NAME
Best practices of front end optimization
1. Use DocumentFragment or innerHTML to replace complex elements insertionDOM operation on browser is expensive. Although browser performance is improved much, multiple DOM elements insertion is still expensive and will affect the page load speed.Assume we have an ul element on our page, we now want to retrieve a JSON list using AJAX and then update the ul using JavaScript. Usually we may write it as :var list = document.querySelector('ul'); ajaxResult.items.forEach(function(item) { // Create element var li = document.createElement('li'); li.innerHTML = item.text; // Manipulate ...
3,570 0 JAVASCRIPT TIPS OPTIMIZATION FRONT END