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

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.

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.

HTML <a> hyperlink target inPrivate / incognito window [duplicate]

This question already has answers here:
How can we open a link in private browsing mode
(2 answers)
Closed 8 years ago.
Is there a way, via Javascript or other code, to open a url in a private/incognito window from an HTML page? Ideally cross-browser or at the very least IE and Firefox.
The anticipated behaviour would be along the lines of
Link
The simplified reason for this is because admins want to be able to log in as users to preview various pages, but without logging themselves out. Whilst there are various other ways around this issue, this would be the simplest (assuming it is possible).
We can't force the visitor to view the page in an incognito/private window. Browsers provide no API that would make that possible outside of an extension.

Pre-loading/refreshing the page in backend before showing on the browser [duplicate]

This question already has answers here:
How do we control web page caching, across all browsers?
(29 answers)
Closed 9 years ago.
I wanted to know if there's a way to refresh/pre-load the CSS of a page before it shows on the browser to a user. Because sometimes we make crucial design changes to our website and the next time we open it the design shows all messed up, until the user refreshes the browser, which then puts the design in the intended positions.
So, what I want is to have a way to refresh a page before it completely loads, so that a user doesn't have to look at a messed up design and doesn't have to leave the site because of such a problem.
Please Help. Appreciated.
In addition to cache settings in the browser, you can add unique code/hash of css in the name.
E.g. http://xxx.static.com/1/css.css
When you deploy the next version, it could be http://xxx.static.com/2/css.css.
So that existing pages are not distorted for users as they would be referring the old css with which everything looks fine.
Thanks

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

Cross Browser Script to make my website as Home Page [duplicate]

This question already has answers here:
How can I set default homepage in FF and Chrome via javascript?
(7 answers)
universal javascript for set homepage functionality [duplicate]
(1 answer)
Closed 7 years ago.
I have a website and I would want to ask users to make my website as Home Page. If they click Yes, I would like to run a script that should make my website as the home page of the user's browser. Have got a Similar Thread here and a solution here. However, the solution present in my latter link works only in IE. I need a cross browser script for this.
Can anyone help me on this.
It is not possible to do this via code in most browsers as a security measure. If it was, any website you visit could automatically make itself your homepage without your agreement.
The fact old versions of IE let you do this is very much the exception rather than the rule.
If you require this behaviour, you would need to write a step by step guide telling people what toolbar to click on, and where to set their homepage in their browser settings.
nitesh, google and bing don't do it... any browser that defaults to google or bing or the hewlett packard home page or whatever come pre-packaged with that site as it's home page... the only way to change this, is manually, either by:
1) high-lighting the address in the address bar and dragging it to the little "home" icon
2) going to the browser's settings and pasting or typing the address
3) installing software package such as yahoo messenger or the like, that changes these settings for you when you agree during the installation process, usually by checking a box and clicking agree

Categories