single-page-application

CSRF Token necessary when using Stateless(= Sessionless) Authentication?

为君一笑 提交于 2019-11-26 10:05:21
问题 Is it necessary to use CSRF Protection when the application relies on stateless authentication (using something like HMAC)? Example: We\'ve got a single page app (otherwise we have to append the token on each link: <a href=\"...?token=xyz\">...</a> . The user authenticates himself using POST /auth . On successful authentication the server will return some token. The token will be stored via JavaScript in some variable inside the single page app. This token will be used to access restricted

Difference between [ngClass] vs [class] binding

♀尐吖头ヾ 提交于 2019-11-26 09:44:15
问题 What is the difference in Angular 2 between the following snippets: <div [class.extra-sparkle]=\"isDelightful\"> <div [ngClass]=\"{\'extra-sparkle\': isDelightful}\"> 回答1: This is special Angular binding syntax <div [class.extra-sparkle]="isDelightful"> This is part of the Angular compiler and you can't build a custom binding variant following this binding style. The only supported are [class.xxx]="..." , [style.xxx]="..." , and [attr.xxx]="..." ngClass is a normal Angular directive like you

AngularJS HTML5 Mode - How do direct links work without server specific changes?

↘锁芯ラ 提交于 2019-11-26 09:08:25
问题 Note: This question could also read: How to support bookmarking of hashbang-less client side mvc frameworks in Java. I am transitioning an angular app that uses hashtags to one that is html5mode . I have successfully set $locationProvider.html5Mode(true); And all links from the landing page (index.html) work fine. The problem is, if partial urls are referenced directly, I get a 404, naturally, since the server endpoint definitions aren\'t coupled to client side-defined routes. So without

Print a div using javascript in angularJS single page application

梦想的初衷 提交于 2019-11-26 07:57:39
问题 I have a single page web application using angularJS. I need to print a div of certain page. I tried the following: The page contains few div (print.html) <div> <div> Do not print </div> <div id=\"printable\"> Print this div </div> <button ng-click=\"printDiv(\'printableArea\');\">Print Div</button> </div> The controller has following script: $scope.printDiv = function(divName) { var printContents = document.getElementById(divName).innerHTML; var originalContents = document.body.innerHTML;

How to make a SPA SEO crawlable?

无人久伴 提交于 2019-11-26 07:52:05
问题 I\'ve been working on how to make a SPA crawlable by google based on google\'s instructions. Even though there are quite a few general explanations I couldn\'t find anywhere a more thorough step-by-step tutorial with actual examples. After having finished this I would like to share my solution so that others may also make use of it and possibly improve it further. I am using MVC with Webapi controllers, and Phantomjs on the server side, and Durandal on the client side with push-state enabled;

Is store.dispatch in Redux synchronous or asynchronous

陌路散爱 提交于 2019-11-26 07:44:21
问题 I realize this is a basic question but I had no luck finding the answer elsewhere. Is store.dispatch synchronous or asynchronous in Redux ? In case it is asynchronous is there a possibility to add a callback after the action has been propagated as it is possible with React ? 回答1: AFAIK, dispatching action is synchronous. In case if you are willing to address the asynchronous call, you can use the thunk-middleware in redux, where dispatch is provided as a callback function which you can invoke

SPA best practices for authentication and session management

走远了吗. 提交于 2019-11-26 06:09:04
问题 When building SPA style applications using frameworks like Angular, Ember, React, etc. what do people believe to be some best practices for authentication and session management? I can think of a couple of ways of considering approaching the problem. Treat it no differently than authentication with a regular web application assuming the API and and UI have the same origin domain. This would likely involve having a session cookie, server side session storage and probably some session API

Single Page Application: advantages and disadvantages [closed]

若如初见. 提交于 2019-11-26 04:01:59
问题 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 3 years ago . I\'ve read about SPA and it advantages. I find most of them unconvincing. There are 3 advantages that arouse my doubts. Question: Can you act as advocate of SPA and prove that I am wrong about first three statements? === ADVANTAGES === 1. SPA is extremely good for very

How to Detect Browser Back Button event - Cross Browser

纵然是瞬间 提交于 2019-11-25 21:58:39
问题 How do you definitively detect whether or not the user has pressed the back button in the browser? How do you enforce the use of an in-page back button inside a single page web application using a #URL system? Why on earth don\'t browser back buttons fire their own events!? 回答1: (Note: As per Sharky's feedback, I've included code to detect backspaces) So, I've seen these questions frequently on SO, and have recently run into the issue of controlling back button functionality myself. After a

How to ajax-refresh dynamic include content by navigation menu? (JSF SPA)

≯℡__Kan透↙ 提交于 2019-11-25 21:47:09
问题 I\'m just learning JSF 2 thanks to this site I had learned a lot in such a short time. My question is regarding how to implement a common layout to all my JSF 2 pages and have only the content part of the page refresh not the whole page whenever I click a link/menu from a different panel. I am using the Facelets approach it does what I want except that each time I click a link from a panel (e.g. menu items from left panel) the whole page is refreshed. What I am looking for is a way to refresh