小编Roy*_*llo的帖子

Edge - navigating on Angular iframe sets history.state to null

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 …

iframe microsoft-edge angular angular-router

5
推荐指数
1
解决办法
68
查看次数

webRequest listener doesn't see headers like 'cookie', 'referer', 'origin'

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.

有任何想法吗?提前致谢!

javascript cookies http-headers google-chrome-extension

2
推荐指数
1
解决办法
2405
查看次数