Permalink
Browse files

Prefetch dialog components from the communication_iframe

When the browser is idle, it will start fetching and caching the
dialog's Javascript, CSS and images. This works on IE9, Firefox
and Chromium.

The trick is to make sure that the communication iframe is open
while the user is busy reading the RP's site. When using the watch
API, this happens automatically at the end of the .watch() call.
  • Loading branch information...
fmarier committed Nov 23, 2012
1 parent cdc6e5b commit fec98808fec87abf86d81d7448a5a59e51b20f8f
Showing with 9 additions and 0 deletions.
  1. +9 −0 resources/views/communication_iframe.ejs
@@ -4,6 +4,15 @@
<head><title>non-interactive iframe</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta charset="utf-8">
+ <%- cachify(util.format('/production/%s/dialog.js', locale), {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/production/dialog.css', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/common/i/grain.png', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/dialog/i/persona-logo-transparent.png', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/dialog/i/arrow_grey.png', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/common/i/button-loader.gif', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/common/i/button-arrow.png', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/common/i/button-arrow-hover.png', {tag_format: '<link rel="prefetch" href="%s">'}) %>
+ <%- cachify('/common/i/button-arrow-active.png', {tag_format: '<link rel="prefetch" href="%s">'}) %>
<%- cachify_js('/production/communication_iframe.js') %>
</head>
<body></body>

0 comments on commit fec9880

Please sign in to comment.