Logic Machine Forum
iframe re-direct - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: iframe re-direct (/showthread.php?tid=2781)



iframe re-direct - Diggerz - 09.08.2020

Hi i was wondering how you would re-direct an iframe url if the requested url is not accessible?

im currently using a dynamic iframe example as below and want to add a re-direct if the requested iframe url is not accessible or times out

Code:
$(function() {
  function seturl(url) {
    $('.iframeurl').find('iframe').attr('src', url);
  }

  $('.btn-1').on('vclick', function() {
    seturl('https://forum.logicmachine.net');
  });

  $('.btn-2').on('vclick', function() {
    seturl('http://openrb.com');
  });
})



RE: iframe re-direct - admin - 10.08.2020

Since iframe points to a different domain you cannot access iframe document at all due to security reasons.
See this for a possible solution: https://stackoverflow.com/a/35838812