Hard reload iframe on partent page reload [duplicate] - javascript

This question already has answers here:
How to refresh an IFrame using Javascript?
(13 answers)
Closed 5 years ago.
I have a master page which has 2 iframes - which are frequently updated. The problem is when I reload the master page - both of the iframes LOAD from CACHE (Chrome takes the cached versions no matter how much time has passed after the last updates of the iframe content). This is so frustrating. Can I force the master page to load the iframes FROM SERVER each time it is reloaded?
Thank you!
Dave

when you call the page then you add time like this www.example.com/iframe.html?q=201710191034123
Code
var d = new Date();
var iframe = $('#secondPage');
iframe.attr('src','www.yoursite.com/yourpage?g='+d.getTime())

Related

Is there any way to define back/forward button effects on a web page? [duplicate]

This question already has answers here:
Javascript : Change the function of the browser's back button
(5 answers)
Closed 8 years ago.
I have a page where the content is delivered mostly though javascript. Hitting the back button would basically exit the page to wherever the user came from instead of showing the previous content. Is there a way to take manual control over what the back/forwards buttons do on a web page?
This is a classic AJAX problem - each page is loaded asynchronously with no new GET from the browser, thus no history.
Look into History API of HTML5 to programatically push page state into the browser history. Other than that you are out of luck.

Refreshing page with window.location.reload() in chrome is causing issue [duplicate]

This question already has answers here:
JavaScript location.reload() is losing post data
(7 answers)
Closed 8 years ago.
In Chrome whenever i try to refresh a page with button click i'm losing all the posted data on that page.
For e.g.
I navigate from Page 1 to Page 2 and pass some data to Page 2 from Page 1. Now when i refresh Page 2 with any of the following lines of the codes:
history.go(0);
OR
window.location.reload();
OR
window.location = window.location.href
After Page 2 is refreshed i loose all the data that i got from Page 1.
This is only happening in chrome. In Firefox and IE 8 after refreshing Page 2 it still has the data which i transferred from Page 1.
Can anyone please guide me on how can i refresh the page without losing the data. Thanks
Do you need to use POST data to load page 2? Try using URL Params to keep the state of your page.
index.html?var1=bla

How can I send a data to an iframe from main page when I working another iframe? [duplicate]

This question already has answers here:
How to communicate between iframe and the parent site?
(7 answers)
Closed 8 years ago.
I have a question about data transfer on iframes as can be seen in the picture below
http://img703.imageshack.us/img703/143/qcvf.jpg
My main page has 2 iframe.
How can I send a data to textbox iframe_b from main page when I working iframe_a?
Thanks.
You can try to set the iframe's src with a hash, and detect hashChange within the iframe. $(window) bind hashchange how to check part hash changed?
If you want to set data into iframe in script directly, I remember, not so sure, if the src of iframe is a different host, you cannot, for security reason.

How does github lets you navigate pages without refresh? [duplicate]

This question already has answers here:
How to change URL in browser without navigating away from page?
(2 answers)
Closed 9 years ago.
I've navigated a lot through the github website. I've observed that whenever I click on a link, the page does not refresh and even the URL in the browser is changed. Moreover, those links are added in the history!
Well, I know that AJAX is a way to go and I know a lot of JavaScript(semi-intermediate level coder) but you can't change the URL with Ajax. Neither can you make those URLs be visible in the history.
So, how the heck do they do it?
There's a lot of tools out there to make this process easy nowadays, check out HistoryJS and NavJS.
Microsoft released an example application harnessing these technologies a while ago named "Big Shelf", which seems to have been taken down unfortunately. Obviously that's only relevant if you're using .NET.

How do I manipulate browser's URL and back button on an "inbox-like-Gmail" application [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How AJAX is done in github source browse?
I have an application that basically have 2 main pages:
Main page with a list of applications (like an inbox list)
A single application page with lot's of things to do there (like a single message)
I have 2 concerns that I don't understand how to solve:
The browser's URL : on the first page it will be www.foobar.com/inbox and on the second page it will be www.foobar.com/inbox?app=1234. How do I do it without really going to another page or refreshing the page
the browser back/forward button - how do I manipulate them so if I am on a single page and I push "back" I go back to inbox and not to the previous page? I read some discussions about it and couldn't understand where to start from.
Look at gmail url and you will see # (hash), like:
document.location.hash;
There are many plugins, you can start from here:
Ben Alman - jQuery hashchange event

Categories