Difference between window.location.assign() and window.location.replace()

Using window.location.assign(“url”) will just cause a new document to load. Using window.location.replace(“url”) will replace the current document and replace the current History with that URL making it so you can’t go back to the previous document loaded. Reference: http://www.exforsys.com/tutorials/javascript/javascript-location-object.html

Adding http headers to window.location.href in Angular app

When you use $window.location.href the browser is making the HTTP request and not your JavaScript code. Therefore, you cannot add a custom header like Authorization with your token value. You could add a cookie via JavaScript and put your auth token there. The cookies will automatically be sent from the browser. However, you will want … Read more

PhoneGap for iPhone: problem loading external URL

I think I’ve found the solution, in the PhoneGap Application Delegate .m file {YourProject}AppDelegate.m, modify the method: – (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; } with – (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = [request URL]; if ([[url scheme] isEqualToString:@”http”] || [[url scheme] isEqualToString:@”https”]) { return YES; } … Read more