Giter Site home page Giter Site logo

Set headers? about chrome HOT 4 CLOSED

chrome-php avatar chrome-php commented on August 17, 2024
Set headers?

from chrome.

Comments (4)

jet-desk avatar jet-desk commented on August 17, 2024

for headers you might to use interception

from chrome.

retardedHacker avatar retardedHacker commented on August 17, 2024

Thank you. Could you point me in the right direction? I have looked into the code but I don't see where I should "intercept".

from chrome.

stale avatar stale commented on August 17, 2024

This issue has been automatically marked as stale because there has been no recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

from chrome.

CyberPunkCodes avatar CyberPunkCodes commented on August 17, 2024

I messed around with this for a bit, and dug through the source trying to figure it out. I wasn't able to set the headers on the initial connection, but I was able to set them on the page instance. I think setting it on the initial connection would make the most sense, and I am unsure if subsequent page requests would retain the headers or not.

$page = $browser->createPage();

$page->getSession()->sendMessageSync(new Message('Network.setExtraHTTPHeaders', [
    'headers' => [
        'Accept-Encoding' => 'identity',
        'Accept-Language' => 'en-US,en;q=0.9',
    ]
]));

$page->navigate($url);

I haven't worked with chromium much, so maybe someone more familiar with it and this project might have a better way.

from chrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.