mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Handle DOMException when embedded in an iframe of different origin
Fixes #932
This commit is contained in:
parent
691b083364
commit
c5753a013c
@ -2162,10 +2162,19 @@ RED.view = (function() {
|
||||
}
|
||||
|
||||
function focusView() {
|
||||
try {
|
||||
// Workaround for browser unexpectedly scrolling iframe into full
|
||||
// view - record the parent scroll position and restore it after
|
||||
// setting the focus
|
||||
var scrollX = window.parent.window.scrollX;
|
||||
var scrollY = window.parent.window.scrollY;
|
||||
$("#chart").focus();
|
||||
window.parent.window.scrollTo(scrollX,scrollY);
|
||||
} catch(err) {
|
||||
// In case we're iframed into a page of a different origin, just focus
|
||||
// the view following the inevitable DOMException
|
||||
$("#chart").focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user