Ajax deep linking without hash sign [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is it possible to do Ajax Deep Linking without hash sign (#) in the url. Knowing that my urls don't point to any controller/action on the server.
For example How does Stackoverflow or Soundcloud to manage the url?
Any help would be appreciated

You could use a query string, but the # is better since it doesn't give the appearance of different resources on the server.
Stackoverflow doesn't use Ajax (afaik) to load pages (if they did, they would use the technique below). I've no idea what Soundcloud does as I don't use them.
Twitter and Github use the history api (pushState and friends) but populate the initial page load server side (i.e. they don't load a default page and then overwrite it using JavaScript).
Doing it server side in this fashion is the preferred approach. It loads the requested content faster (and without the flash of homepage problem), continues to work if JavaScript fails, and is search engine friendly.

Related

Is there any way to unshorten the url using pure javascript or jquery? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm looking for a method through which I can get the unshortened URL of a shorten URL which I input in my javascript file.
function(short_url){
some method;
return full_url;
}
like I would call a function and pass a shortened URL of bitly through it and it will return me the full URL. what will be the method or process should I use
I'm using simple hosting for this code so can't use node.js
Since you said you can't use Node.js, I assume you mean "With JS running in the browser".
No.
You would need an API that would allow you to make an HTTP request to a URL that has a redirect response and then read the Location header from it.
This will fail for two reasons:
The APIs browsers provide to JS for making HTTP requests follow redirects transparently so you can never read the Location header.
They would be cross-origin requests and would be blocked by the Same Origin Policy in most cases.
Sime short URL servers display an interstitial HTML document telling the user that they are being redirected. In those cases, problem 1 goes away and, if it weren't for problem 2 still affecting this, you would need to write a custom parser for each service's HTML document to extract the target URL from.

Getting updating in codebehind C# variable to asp.net [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I wrote a small code in c# that reads files from the hard drive and outputs that info to a webpage using asp.net.
Information about those files is being changed in the codebehind.
I managed to create variables to read and display the info on the webpage, but they change only after a refresh. When I used setTimeout it would always read the same variable, leaving me thinking that the codebehind does not get re-executed.
How would it be possible to have them updated live without needing to refresh the entire page?
This is somewhat vague but if you want updates to the values on your page after loading, you'll need to use some javascript to grab new values and then more javascript to update values on your page.
There are some great frameworks out there. Unless you have a lot of front-end logic you need to perform through javascript, I'd keep it as simple as possible and throw jQuery in there for the AJAX calls (fyi, this is not the only solution, there are 10+ different ways to skin this same cat).
If you want a bit more efficiency, you could look into using SignalR - which wraps long polling or web sockets (depending on browser capability) on the front end and signals those subscribing pages on the backend only when changes have occurred to data.
Link: http://www.asp.net/signalr
There is no "right" answer to your question so the best I or anybody can do is guide you in a direction. Hopefully this answer helps you.

What can I do to create an always-live HTML page? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have been searching across the Web to find a solution to this:
Basically what I want to setup is a way to have an HTML page on a live production site to kept updated. This is because I have setup a SilverStripe Application as part of a graphics system (green chroma key) that runs through normal HTML.
AJAX load doesn't seem to be an option here since the load would be every 1 second or half a second to make sure the page is live.
I looked into web socket quite vaguely but the whole concept of integrating it with my project confused me entirely.
Anyone got any ideas of what could be done?
To do this you'll need a combination of:
AJAX, you'll need to never do a full page load after the initial Web 1.0 request.
Session history management, you'll need this in order to not break the browser navigation (e.g. back/forward buttons).
Web Sockets, you'll need this so when new content arrives on the server it is received by the client without first having to poll the server.
Web sockets will be the greatest challenge. I listed them in the order in which you should approach the project, in three phases.

Build website using JSP or Javascript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have to build a website which involve e-commerce stuff like it should allow the users to login and then view the available items. Once the user selects the items and makes payment, it may need additional information in the form of some images/videos to complete the order. So, after payment step, it prompts the user to upload the file and when the file is uploaded on the server, request is complete and the user is kept informed about the status.
All the core functionality is already implemented using REST-ful webservices. I am not able to decide if I should implement the website using HTML+JS (using AJAX to call webservices) or should still use JSP and call webservices using java at server side? Someone suggested me that using JSP is better since it will execute on server side and hence will be secured and faster. But, I somehow feel that HTML+JS is easier to go. Is there some specific advantage to use a server side script like JSP for this purpose? Any ideas are most welcome.
Yes server side scripting will be fruitful for this purpose for security constraints. Or you can use angular js though they are easy to learn and they are secure and can make fast XHR request response. :)

Graceful improvement (not degration) with Angular.js? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
We're relaunching the landing page of our company (contains an info, jobs, team and help section) and decided we'll no longer maintain a Rails project only for this part of our service and therefore switch to static HTML.
As we want to give our HR and support team the chance to edit the texts (especially in the jobs and help section) without bugging the dev team, we'll get an Angular.js app running on the page and patch in the content using a JSON APi (like the one Wordpress.com offers http://developer.wordpress.com/docs/api/ or we might even use https://www.contentful.com/).
However, as we need our landing page to load really fast (conversion is king), we're thinking of serving the initial part of our landing page as static HTML and gracefully add Angular.js after the user has access to the most important information. We don't care if people with deactivated JS can't use the rest of our page, therefore we'd call this process graceful improvement.
Are there any best practices and/or Angular.js modules out there for achieving what I just described? What's the right terminology for this effect?
P.S.: We'll take care of SEO by rendering the rest of our landing page (team, jobs, etc.) using Phantom.js, therefore SEO is not a topic. It's only about the loading speed of the initial part of our landing page.
You could render the static page (whichever way you want to produce those) and add an event listener after the page is loaded. Then in the event listener, you could leverage angular.bootstrap to start the app manually. That way Angular can take its sweet time about it and not bog down the user.

Categories

Resources