19
Andrey Legaev [email protected] Outsourcing front-end platforms & cross-domain issues 08.08.2009

Outsourcing Front End Platforms Cross Domain

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Outsourcing Front End Platforms Cross Domain

Andrey Legaev

[email protected]

Outsourcing front-end platforms & cross-domain issues

08.08.2009

Page 2: Outsourcing Front End Platforms Cross Domain

What is the outsourcing?

Wikipedia

Outsourcing is subcontracting a process, such as product design or manufacturing, to a third-party company.

Page 3: Outsourcing Front End Platforms Cross Domain

Outsourcing in web-technologies: Server-to-server

Page 4: Outsourcing Front End Platforms Cross Domain

Outsourcing in web-technologies: 3rd party service pages

Page 5: Outsourcing Front End Platforms Cross Domain

Outsourcing in web-technologies: Front-End Embedding

Page 6: Outsourcing Front End Platforms Cross Domain

Possible solutions

Flash Object embedding (YouTube)Embedding via IFrameDHTML embedding Silverlight, Java Applets, etc.

Page 7: Outsourcing Front End Platforms Cross Domain

Flash Object embeddingInteraction with the main document

You are able to communicate with the page via JavaScript statements evaluating.Your component is separated from main document.

Interaction with your serverYou can interact with your server without limitations (crossdomain.xml)

Page 8: Outsourcing Front End Platforms Cross Domain

Embedding via IFrameInteraction with the main document

You can’t interact with main document because of same-origin policy limitations

Interaction with your serverYou can interact with your server without limitations (because of same domain)

Other issuesYou have to override everything in CSS because of Styles inheritanceYour JavaScript code is completely isolated from the main document

Page 9: Outsourcing Front End Platforms Cross Domain

DHTML embeddingInteraction with the main document

You are able to do anything with the main document;

Interaction with your serverAny interaction with your server is prohibited because of cross-domain issues; you have to use hacks and workarounds.

Other issuesYour code is working inside foreign site:

Your HTML mark-up should look nice with all doctypes;You have to override all of CSS properties with maximum priority (inline-styles);Your JavaScript may conflict with site’s JavaScript libraries.

Page 10: Outsourcing Front End Platforms Cross Domain

DHTML embedding: Solving cross-domain issues

Hidden IFRAME:Can send GET and POST requestsWe can’t obtain result of the query

Proxies based on Flash (Java, Silverlight, etc.):Time to load plugin (0.2-1.5 sec)Could do any requests with right crossdomain.xml configuration

Dynamic <script> tag creation:Can’t send POST requestsCaching issues

Proxy sub-page and interaction via location.hash .Suitable for commands transmitionCould be used for data transmition (~1KB limit)May cause issues with the “Back” browser’s button

Page 11: Outsourcing Front End Platforms Cross Domain

HTML mark-up should look nice with all doctypes

No DOCTYPE givenUnrecognized DOCTYPEHTML 3.2HTML 4.0 StrictHTML 4.0 TransitionalHTML 4.01 StrictHTML 4.01 TransitionalXHTML 1.0 StrictXHTML 1.0 TransitionalXHTML 1.0 Strict w/XMLXHTML 1.0 Transitional w/XMLXHTML 1.0 Frameset w/XML

Page 12: Outsourcing Front End Platforms Cross Domain

Hardcode all CSS Isolate you JavaScript

Don’t use DIVs, TABLEs will help you;Hardcode all styles in style=“” attribute:

Used & unused CSS rules.

Use following wrapper for all your JS blocks:(function () {// your code})();Don’t use global variables

Page 13: Outsourcing Front End Platforms Cross Domain

DHTML embedding: Session handling issues

HTTP session handling approaches:Cookies;Hidden field; URL containing session identifier.

Page 14: Outsourcing Front End Platforms Cross Domain

DHTML embedding: Session handling issues

Cookies 3rd party cookies aren’t supported by all browsers;

Hidden field Is not suitable for DHTML embedding;

URL parameter

Required additional effort on client-side.

Page 15: Outsourcing Front End Platforms Cross Domain

3rd Party Cookies Support

Test description MSIE7 MSIE8 FF3 Safari Opera Chrome

Are restrictions on third-party cookies on in default config? YES YES NO YES NO NO

Option to change third-party cookie handling? YES YES YES YES persisten

t only YES

Is P3P policy override supported? YES YES NO NO n/a NO

Does interaction with the IFRAME override cookie blocking? NO NO NO YES n/a NO

Are third-party cookies permitted within same domain? YES YES YES YES n/a YES

http://code.google.com/p/browsersec/wiki/Part2#Third-party_cookie_rules

Page 16: Outsourcing Front End Platforms Cross Domain

Front-End Embedding: Performance issues

Load is equal to sum of all integrated sites load.

Page 17: Outsourcing Front End Platforms Cross Domain

Front-End Embedding: Performance issues

Page 18: Outsourcing Front End Platforms Cross Domain

Scalability SuggestionsYour resources is loaded in addition to main content – make them small as possible;Use scripts minification/obfuscation;Wrap HTML & CSS for widgets to JavaScript, use only one request to fetch functionality and HTML & CSS;Use deep caching for the static data;Move static data (scripts & images) to light web-server;Use CDN