How can I refresh a page in an iFrame after a specified number of seconds (greater than 5)?
Here is the code snippet I am currently using:
<iframe sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts" class="iframe" ng-show="$ctrl.getFrameURL() !== 'Default URL'" ng-src="{{$ctrl.getFrameURL()}}" width="100%" height="100%" scrolling="yes" frameBorder="0" id="remotePageFrame"></iframe>
I have looked into solutions on StackOverflow where users suggested refreshing the page by updating the scope. However, I do not want to update the scope as the URL value in the scope variable remains the same. Is there a JavaScript or AngularJs solution to refresh the page in an iFrame without updating the scope?
Update-1
The solution proposed by @sarvon ks works for pages hosted within my project, but it throws an error when trying to refresh external/third-party pages. This occurs because when looping over iFrames to open multiple pages, most of them are external pages. Refreshing external pages results in an Uncaught SecurityError exception.
-- Uncaught SecurityError: Blocked a frame with origin "http://localhost:63342" from accessing a cross-origin frame.
This issue is extensively discussed in an existing thread. Are there any alternative workarounds to refresh a page in an iFrame?