This question already has answers here:
How do I modify the URL without reloading the page?
(20 answers)
Closed 8 years ago.
I am in a page with url
https://mysite.com/tst/v1/my-app/var/$%5Btest_new_var%5D.
On click i want to change the url to
https://mysite.com/tst/v1/my-app/" without reloading the page.
How can i do that?
please help,
Thanks.
In newer browsers that support history.pushState you can replace the url without reloading.
Lets say a user browses to http://example.com/ernie.html
window.history.pushState({ foo: "bar" }, "page 2", "bert.html");
Will change the address bar to http://example.com/bert.html, but won't cause the browser to load bert.html or even check that bert.html exists.
Related
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.
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
This question already has answers here:
Redirect parent window from an iframe action
(14 answers)
Closed 9 years ago.
I have a html page and on GO button i have write redirecting code
window.location.replace(url);
I put this page in iframe and on click on GO button result page should open in the existing page replacing the url of the browser but it is opning in iframe only...
I tried
<base target="_parent" /> also but no luck
window.top.location.href is what you're looking for.
Your result page needs to break out of the iframe:
http://www.w3schools.com/js/tryit.asp?filename=tryjs_breakout
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.
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.