Search Posts

Category: browser

Call function at onbeforeunload page in AngularJS [duplicate]

This question already has an answer here: Showing alert in angularjs when user leaves a page 6 answers In my web app I need to call a function when user close browser tab or window. In AngularJS I can do something like: $window.onbeforeunload = function(event){ /* some code here */ } My considerations after a lot of try: I can’t call an asynchronous function because browser will close before its execution. I suppose I can’t […]

Do scripts loaded with ocLazyLoad get cached by the browser?

how to Do scripts loaded with ocLazyLoad get cached by the browser? Sorry if this is a newbish question. I’m using the ocLazyLoad plugin with AngularJS and UI Router. I am using ocLazyLoad with Ui router to dynamically load/lazy-load in my controllers based on the route that is hit in my webapp. My question is will these lazy-loaded scripts get cached by the browser? And if they are is there a way to force the […]

Unable to handle a function on browser refresh

When I click refresh, I want to run a function which I am unable to. The refresh should be handled only when there are unsaved changes. var timer; var isNavigation = false; $window.onbeforeunload = function(evt) { isNavigation = true; debugger; if ($rootScope.isReviewFormSubmitEnabled) { debugger; var message = ‘ ‘; timer = $timeout(stayOnPage, 100); evt = evt || window.evt; evt.returnValue = message; return message; //Handling leave click on leave/stay option $window.onunload = function() { debugger; $appTimeOutService.stopTimeOut(); […]

Angularjs how to get browser history list?

I want to remove my history, so I use this code $state.go(toGo, params, {location: ‘replace’}) When I use this, I could remove the very last history. And my question is, how to remove history before the last removed page. For example, to see the content of an item, I move into detailPage Click edit Button to edit this item, and move into editPage. After I finish editing this, press finish Button, and move into detailPage […]