We have an Angular 7 app that sits inside an iframe on all of our clients websites. All the navigation inside the app is done through this helper class:
import {Injectable} from '@angular/core';
import {Router} from "@angular/router";
@Injectable()
export class NavigationService {
constructor(private router: Router)
{}
private navigate(path, queryParams = {}){
this.router.navigate([path], {
queryParams: queryParams,
skipLocationChange: true
}));
}
}
Run Code Online (Sandbox Code Playgroud)
One of our clients has some JS code (on their main site, not our iframe) that tries to access history.state.persistent …
We wrote a Chrome-extension that, using the onBeforeSendHeaders event, adds a cookie to each web request:
chrome.webRequest.onBeforeSendHeaders.addListener(addCookie, {
urls: ["<all_urls>"]
}, ["blocking", "requestHeaders"]);
function addCookie(details) {
if (details.url.match(/ourWebsite/)) {
details.requestHeaders.forEach(function (requestHeader) {
if (requestHeader.name.toLowerCase() === "cookie") {
//Code that adds a cookie with a value
}
});
return {requestHeaders: details.requestHeaders};
}
}
Run Code Online (Sandbox Code Playgroud)
它适用于每个人的 Chrome,但我自己的。在调试扩展时,我注意到details.requestHeaders数组没有cookie标头(这总是假的:)requestHeader.name.toLowerCase() === "cookie"。
我的第一个想法是另一个扩展程序搞砸了我们的,所以我尝试隐身(不允许其他扩展程序),但它没有用。
在扩展的清单中,我们在permissions.
有任何想法吗?提前致谢!