Skip to content

Commit

Permalink
Fix #2033: Rstudio Viewer window not closed on shiny::stopApp()
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed May 3, 2018
1 parent 9c3a0c8 commit c49a289
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 49 deletions.
22 changes: 2 additions & 20 deletions inst/www/shared/shiny.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

26 changes: 2 additions & 24 deletions srcjs/shinyapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,30 +141,8 @@ var ShinyApp = function() {
};

this.$notifyDisconnected = function() {

// function to normalize hostnames
var normalize = function(hostname) {
if (hostname === "127.0.0.1")
return "localhost";
else
return hostname;
};

// Send a 'disconnected' message to parent if we are on the same domin
var parentUrl = (parent !== window) ? document.referrer : null;
if (parentUrl) {
// parse the parent href
var a = document.createElement('a');
a.href = parentUrl;

// post the disconnected message if the hostnames are the same
if (normalize(a.hostname) === normalize(window.location.hostname)) {
var protocol = a.protocol.replace(':',''); // browser compatability
var origin = protocol + '://' + a.hostname;
if (a.port)
origin = origin + ':' + a.port;
parent.postMessage('disconnected', origin);
}
if (window.parent) {
window.parent.postMessage("disconnected", "*");
}
};

Expand Down

0 comments on commit c49a289

Please sign in to comment.