jQWidgets Forums
jQuery UI Widgets › Forums › Grid › grid destroy in an iframe
Tagged: #jqwidgets-grid, grid, javascript grid, jquery grid
This topic contains 5 replies, has 2 voices, and was last updated by Peter Stoev 7 years, 6 months ago.
-
Author
-
Hi,
I have a jqxgrid in an iframe. On click of a row we navigate to another link but before that we destroy the jqxgrid. However, when the grid is destroy() is called, following code from jqxgrid.js destroy() method is throwing an error,“REMOVED CODE DUE TO END USER LICENSE AGREEMENT VIOLATION!!!”
Error is ‘Blocked a frame with origin “https://www.xyzsrc.com” from accessing a cross-origin frame’
This is because the iframe’s src is in different domain than the parent window’s domain. However, both the parent window and iframe’s url are in same domain.
My question is, why is the grid destroy referring to the parent window and how can we tackle this situation?Thanks,
ShakeelHi Shakeel,
It cannot be tackled from us. Grid removes an event handler which the Grid added during its initialization and that’s totally normal.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Sorry for getting back on this old ticket. However, upon further digging into the issue, what I noticed is that when adding the event handler in _addHandlers() method, the code is wrapped in a try/catch block along with additional checks for document.location.host before adding the handler on ‘mouseup.grid’ event. I think this takes care of the iframe situation while adding the handler. However, in the grid’s destroy() method, before removing the handler for ‘mouseup.grid’ event, 1) Its not wrapped in try/catch block. 2) No additional check is done for document.location.host that causes the cross domain error and grid destroy fails.
Hope I made a valid point here and request you to have a closer look at this issue before dismissing it as normal behavior.
It does not matter whether it is in a try/catch block or not, because of the if blocks.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/yea, right, it does not go to the catch block since the if block is handling it. My issue is, the if block is not there in destroy() method. I tried overriding the destroy() method by adding the if blocks similar to what we have during addHandler() and it works fine. Is this something you can do?
Well, but it is there within the destroy method implementation. At least, it is in the version available on our website. I cannot guarantee for old versions.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.