Logout on tab closed I want to trigger logout when I close any tab of my application. I tried $(window).on('unload', logout); and $(window).on('onbeforeunload', logout); That works fine but events also triggered when I reload page. How can I prevent this on reload? Before asking I found some options like event.currentTarget.performance.navigation.type but no posibility to separate reload and close in this way. Is there any opputurnity to trigger logout only on tab closed?
Is there a way in javascript to detect if the unload event is caused via a refresh, the back button, or closing the browser? I am currently looking at the "unload" event of a window to try to determine how the "unload" event was triggered, but am having little success. Is there a way to determine how the javascript event was triggered?   Page Refresh Back Button (or navigate away from the page) Closing the Browser   Essentially I need to execute some code only when the browser window is being closed, not refreshed or navigated away from.  Purpose: When a customer does an update of our software, the update will redirect their first Internet request to an offer page. There is a button for a "Do Not Bother" option, but some users will simply close their browser. Upon closing the browser, I need to duplicate the "Do Not Bother" functionality so the user no longer gets redirected to the offer page. Simply attaching to the "unload" event will not work due to the different ways of leaving a page.
How Do I Compute the Eigenvalues of a Small Matrix? If I have a $2\times 2$ or $3\times 3$ matrix, how should I go about computing the eigenvalues and eigenvectors of the matrix?  NB: I am making this question to provide a unified answer to questions about eigenvalues of small matrices so that all of the specific examples that come up can be marked as duplicates of this post. See . This came to my mind after I learned the following from :  where T : struct   We, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc.  Some of us even mastered the stuff like , , , , ...  But what are the most hidden features or tricks of C# that even C# fans, addicts, experts barely know?  Here are the revealed features so far:    Keywords    by  var by  using() statement by  readonly by  as by  as / is by  as / is (improved) by  default by  global:: by  using() blocks by  volatile by  extern alias by    Attributes    by   by   by   and  by   by   by   by    Syntax    (coalesce nulls) operator by  Number flaggings by  where T:new by  Implicit generics by  One-parameter lambdas by  Auto properties by  Namespace aliases by  Verbatim string literals with @ by  enum values by  @variablenames by  event operators by  Format string brackets by  Property accessor accessibility modifiers by  Conditional (ternary) operator (?:) by  checked and unchecked operators by  implicit and explicit operators by    Language Features   Nullable types by  Anonymous types by  __makeref __reftype __refvalue by  Object initializers by  Format strings by  Extension Methods by  partial methods by  Preprocessor directives by  DEBUG pre-processor directive by  Operator overloading by  Type inferrence by  Boolean operators  by  Pass value-type variable as interface without boxing by  Programmatically determine declared variable type by  Static Constructors by  Easier-on-the-eyes / condensed ORM-mapping using LINQ by  __arglist by    Visual Studio Features   Select block of text in editor by  Snippets by      Framework   TransactionScope by  DependantTransaction by  Nullable&lt;T&gt; by  Mutex by  System.IO.Path by  WeakReference by    Methods and Properties   String.IsNullOrEmpty() method by  List.ForEach() method by  BeginInvoke(), EndInvoke() methods by  Nullable&lt;T&gt;.HasValue and Nullable&lt;T&gt;.Value properties by  GetValueOrDefault method by    Tips &amp; Tricks   Nice method for event handlers by  Uppercase comparisons by  Access anonymous types without reflection by  A quick way to lazily instantiate collection properties by  JavaScript-like anonymous inline-functions by    Other   netmodules by     by     by Find the condition on $a$ and $b$ so that the two tangents drawn to the parabola $y^2=4ax$ from a point are normals to the parabola $x^2=4by$ Find the condition on $a$ and $b$ so that the two tangents drawn to the parabola $y^2=4ax$ from a point are normals to the parabola $x^2=4by.$  The required condition is $a^2&gt;8b^2$.I dont know how to prove it.I tried.  Let $(h,k)$ be the point from where tangents are drawn to the parabola $y^2=4ax$.Let $m_1,m_2$ be the slopes of the tangents.Equations of tangents are $y=m_1x+\frac{a}{m_1}$ and $y=m_2x+\frac{a}{m_2}$ and equations of normal to the parabola $x^2=4by$ is $y=m_1x-2bm_1-bm^3_1$ and $y=m_2x-2bm_2-bm^3_2$.  As $y=m_1x+\frac{a}{m_1}$ and $y=m_1x-2bm_1-bm^3_1$  are the same lines.Therefore,$\frac{a}{m_1}=-2bm_1-bm^3_1$  $bm^4+2bm^2+a=0$  And I am stuck.I cannot get the desired condition.Please help me. Kinetic energy conservation in a collision Kinetic energy conservation in collision.  In any type of collision type of collision if we take the system to comprised of both bodies then the net external force is zero. So the work done by external force is also zero. By the relation $W=K_f-K_i$ as $W$ is zero hence kinetic energy is conserved. But this not the case.   Can you tell me what is the flaw in my argument? Some people say that the argument has neglected the fact that some kinetic energy is transformed into heat. But heat is created due to the interactions between bodies during collision which is thus an internal force and thus shouldn't affect kinetic energy. Proof about Graph with no triangle I've just answered .  After accepting the answer, the OP then changed his question to another problem - which I know I shouldn't have answered (I should have requested as new question) but I updated my answer anyway.  The OP has now edited his question to remove the essence of either the original or new problem, and instead has a statement saying that the problem has been fixed.  What is the correct thing to do here?  Roll the question back so it's in its original state? Roll it back to the "new problem" state? Leave it and let him continue to get downvoted and/or closed by people who didn't see the original question? How can one express frequentist p-value in terms of Bayesian concepts? To what extent is WhatsApp's statement on secure messaging realistic? Ball swung in a horizontal circle, can the string ever by exactly horizontal to the ground? You swing a ball on the end of a lightweight string in a horizontal circle at constant speed.  Can the string ever by truly horizontal?  If not, would it slope above the horizontal or below the horizontal?  Why? Requesting raw data from previously published research Is my processor 64 or 32 bit? Volume of bounded region between sphere and a plane In many courses, say Linear Algebra, Group Theory, Topology, instructors often say that knowing that certaing objects are isomorphic, sometimes makes life easier because we can work with more friendly objects.  Is there any example of using isomorphism concept to solve a non trivial concrete problem?   I must say, I'm not looking on important or famous isomorphic objects, but on non trivial application of the concept of isomorphism used in order to solve another kind of problem. Let L1 be the line passing through the point $P_1=(−11, 10, −1)$ with direction vector $\vec d_1=\begin{bmatrix}−2\\ 3\\ −1\end{bmatrix}t$, and let $L_2$ be the line passing through the point $P_2=(−8, 9, 10)$ with direction vector $\vec d_2=\begin{bmatrix}−1\\ 3\\1\end{bmatrix}t$. Find the shortest distance, $d$, between these two lines, and find a point $Q_1$ on $L_1$ and a point $Q_2$ on $L_2$ so that $d(Q_1,Q_2) = d$.   I dont really understand how to properly approach this question, how do i start? Why do universal constants have the values they do? Do I have 32-bit or 64-bit? Prove that $ S=\{0\}\cup\left(\bigcup_{n=0}^{\infty} \{\frac{1}{n}\}\right)$ is a compact set in $\mathbb{R}$. Prove that $ S=\{0\}\cup\left(\bigcup_{n=0}^{\infty} \{\frac{1}{n}\}\right)$ is a compact set in $\mathbb{R}$, but $\bigcup_{n=0}^{\infty} \{\frac{1}{n}\}$ is not a compact set.   (Can we use definition of compact set for this problem? ) NullReferenceException in Unity Primary ideals in Noetherian rings For an $R$-module $M$ I have the following definition for a submodule $N\subset M$ to be $\mathfrak{p}$-primary: this is the case when $\text{Ass}(M/N) = \{\mathfrak{p}\}$, that is, $M/N$ is coprimary or $(0)$ is a primary submodule.  Now for an ideal $\mathfrak{q} \subset R$ this definition gives that $\mathfrak{q}$ is $\mathfrak{p}$-primary iff $\text{Ass}(R/\mathfrak{q}) = \{\mathfrak{p}\}$. It can be shown that this is equivalent with $\mathfrak{p}^n \subset \mathfrak{q}$ for some $n\in \mathbb{N}$ and the condition \begin{align*} \forall r,s \in R: rs \in \mathfrak{q}, r\not\in \mathfrak{p}\Rightarrow s \in \mathfrak{q}. \end{align*}     Now I suspect that if $R$ is Noetherian, and if $\mathfrak{q}$ is $\mathfrak{p}$-primary, then we have $\sqrt{\mathfrak{q}} = \mathfrak{p}$. I have shown this for PID's, but does this generaly hold?    And if so, is every ideal $\mathfrak{q}\subset R$ then $\sqrt{\mathfrak{q}}$-primary?   Many thanks. Show $1/(1+ x^2)$ is uniformly continuous on $\Bbb R$.