Avatar of JohnLourdu
JohnLourduFlag for Afghanistan

asked on 

how to reload iframe content?

I have creating an inline html editor in the browser.
I have loading the html file using "iframe". Loaded iframe content is located in same domain.
Example:
http://172.26.6.28/epubapp/LoginSystem/page1.php
In the above page1.php I have dynamically loaded iframe content like this:
<iframe scrolling="no" frameborder="0" height="100%" class="readium-flowing-content" style="position: relative; z-index: 0; top: 0px; left: 0px; width: 956px; height: 436px; padding-left: 53px; padding-right: 53px; margin-left: 0px;" src="epub_content/siddhartha3/OPS/s007-Part-001.xhtml" title="Siddhartha - EPUB3"></iframe>
Using HTML5 contenteditable I have edited iframe content and save using ajax and php.
All the above functions are fine. But I refresh the page1.php, iframe content not reloaded. Please advice how to solve this issue.
JavaScriptAJAXPHP

Avatar of undefined
Last Comment
Ironhoofs
Avatar of Ironhoofs
Ironhoofs
Flag of Netherlands image

Maybe its allready working, but your browser / webserver reloads the iframe content from cache. You could check this by adding some unique data to your request (i.e. src="epub_content/siddhartha3/OPS/s007-Part-001.xhtml?uid=12345) and disabling the webbrowser cache.
Avatar of JohnLourdu
JohnLourdu
Flag of Afghanistan image

ASKER

Manually i have to change uid iframe content reloaded. But I have using below code in onload not working:
if (localStorage.getItem('flag')) {
var count = localStorage.getItem('wrapcount');

//document.domain = document.domain + '/epubapp/LoginSystem/';
//alert(document.domain);

for (var i = 1; i<=count; i++) {
var curFrame = localStorage.getItem('curhtmlpath'+i);
var curCont = localStorage.getItem('curhtmlbody'+i);
//alert(curCont);
//$("iframe[src='"+curFrame+"']").contents().find("body").html(curCont);
var newid=curFrame+"?uid=12345";
alert(newid);
$(".readium-flowing-content").attr("src",newid);
}

}

Open in new window

Please advice.
ASKER CERTIFIED SOLUTION
Avatar of Ironhoofs
Ironhoofs
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo