Skip to content

Commit

Permalink
Added direct call of phantom in order to avoid troubles with old brow…
Browse files Browse the repository at this point in the history
…seres(IE < 9 etc)
  • Loading branch information
Oleg Belousov committed Oct 30, 2013
1 parent 1369e2e commit b4bbcca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
12 changes: 0 additions & 12 deletions angular-seo-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ var renderHtml = function(url, cb) {
// page.onConsoleMessage = function(msg, lineNum, sourceId) {
// console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
// };
page.onInitialized = function() {
page.evaluate(function() {
document.addEventListener('__htmlReady__', function() {
window.callPhantom();
}, false);
setTimeout(function() {
window.callPhantom();
}, 10000);
});
};
page.open(url);
};

server.listen(port, function (request, response) {
var route = parse_qs(request.url)._escaped_fragment_;
Expand Down
6 changes: 3 additions & 3 deletions angular-seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
$rootScope.htmlReady = function() {
$rootScope.$evalAsync(function() { // fire after $digest
setTimeout(function() { // fire after DOM rendering
var evt = document.createEvent('Event');
evt.initEvent('__htmlReady__', true, true);
document.dispatchEvent(evt);
if (typeof window.callPhantom == 'function') {
window.callPhantom();
}
}, 0);
});
};
Expand Down

0 comments on commit b4bbcca

Please sign in to comment.