0

I'm trying to ue Angularjs in my offline application. All files get loaded directly, without a webserver (so from file://[PATH]). This works the first time, but then angular appends #/ to the back of the url (so index.html becomes index.html#/). When refreshing the page on this url, the firefox console shows that jQuery now claims that the operation is insecure, while the only change was the slightly modified url.

I've tried to set html5mode enabled to get rid of the #, but this only leads to a '10 digest iterations reached' list of errors.

My main index file contains

<script type="text/ng-template" src="viewparts/contactlistview.html"></script>

and my routes look like this:

var contactlistModule = angular.module("AugmentedContactList", ['ngRoute']);

contactlistModule.controller(ContactlistController);

contactlistModule.config(function($locationProvider, $routeProvider) {

    $routeProvider.when('/', {
        controller: 'ContactlistController',
        templateUrl: 'viewparts/contactlistview.html'
    }).when('/contact', {
        controller: 'ContactController',
        templateUrl: '/viewparts/contact.html'
    }).otherwise({
        redirectTo: '/'
    });
});
Valyrion
  • 2,342
  • 9
  • 29
  • 60

1 Answers1

0

Check out the answer to this question:

SecurityError: The operation is insecure - window.history.pushState()

Browsers implement different security policies when dealing with file:// URLs so that may be why your console is screaming at you. Are you trying to retrieve files from any other origin (server)? If so, you may have run into a Same Origin Policy issue. Your files will need to be from the same domain, same subdomain, same protocol (http vs https) and same port.

Community
  • 1
  • 1
  • As far as I know, I'm not doing anything different when I refresh the page. I can load it the normal way (/index.html) once. The routing works, loads the correct view and for some reason appends #/ to the url. Refreshing now breaks everything because of the jQuery error that suddenly shows up. – Valyrion May 05 '14 at 10:07