Is it possible to change the URL for $location
in AngularJS within an Electon app but without implicitly loading that URL? The problem is that Electron is loading index.html
(and other resources) locally, which is intended. But then of course it also sets $location
to the local file system.
Background: The reason why I need $location
to point to the server is that there is some existing legacy code (which I must not change) and this code uses e.g. $location.search
. So after the Electron app has started I'd need to set the location correctly, so that this legacy code can work.
UPDATE 17.07.2020
Here is the requested example code:
I'm trying to set the location with window.location = "https://example.com?param1=test"
so that the AngularJS function $location.search()
returns param1=test
. The problem is, as mentioned above, that when setting window.location
, Electron loads the index.html from that server and replaces the content of the BrowserWindow
. But I want to load those resources (index.html, *.js, *.css locally) I also tried:
window.location.href = ...
window.location.assign (...)
window.location.replace (...)
but all of these are reloading the page as well.