简体   繁体   中英

Show content from external website iframe and prevent from framekilling

I am trying to create a toolbar similar to what Stumbleupon uses. I have built a simple toolbar using an iframe but when I try to get the content of some websites, they will break out of the iframe. I have however seen another service ( http://bloglovin.com ) that have successfully bypassed this frame killer. What is the best method to create a toolbar like this?

Since an iframe/frameset is blockable by an external website (framekiller) is there a way to load an external website that always will work and shows they entire external website pretty much without complications. My problem is that I need a toolbar function (like stumbleupon) without and risk of the user break out of the frame.

Thanks in advance

If you implement onbeforeunload then instead of directly closing the frameset it will prompt the user with a dialog which you can customize to let the user know they're closing the toolbar.

window.onbeforeunload = function(e) {
  return 'Why you no want toolbar!? D:';
};

Or if you don't want to prompt the user, you could redirect again to the url with the toolbar on that method call, but I haven't tested this so there may be something off there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM