Git Product home page Git Product logo

Comments (6)

ivanceras avatar ivanceras commented on September 3, 2024 1

Update: it looks like commenting out this line of code prevents it the console output from showing
which is also equivalent to setting debug to false.

if (w->debug) {
    WebKitSettings *settings =
        webkit_web_view_get_settings(WEBKIT_WEB_VIEW(w->priv.webview));
    //webkit_settings_set_enable_write_console_messages_to_stdout(settings, true);
    webkit_settings_set_enable_developer_extras(settings, true);
  }

I need to look for the granular settings like the console messages format to not include the source url.
This is a deep rabbit hole and i thought it is.

from web-view.

L-as avatar L-as commented on September 3, 2024

I think the only thing you can do is monkey patch console.log to do nothing, although I think disabling debug mode (parameter passed to run) also disables console.log output.

from web-view.

ivanceras avatar ivanceras commented on September 3, 2024

Is the code in the rust code, or in the webkit-gtk which is a standard debian package. I'm not sure if will work, editing the include files of libwebkit-gtk-dev.

from web-view.

Boscop avatar Boscop commented on September 3, 2024

I think you can just set debug to false or do console.log = function() {};
See also my issue here: webview/webview#75
The best way seems to be to use RPC and log from the Rust code..

from web-view.

OtterCode avatar OtterCode commented on September 3, 2024

So, I'm having trouble because intercepting console.error isn't working. My current solution has been:

console.log = console.info = console.error = (str) => {
  const consoleElem = document.getElementById('console');
  const out = typeof str === "string" ? str : JSON.stringify(str)
  consoleElem.appendChild(document.createElement('li')).textContent = out;
  if (consoleElem.childNodes.length > 1000) {
    consoleElem.firstChild.remove();
  }
  consoleElem.scrollTop = consoleElem.scrollHeight;
}

It works perfectly for normal logging, giving console output in the window itself. The result for errors is the usual impossibly large tty spam on the command line. The whole index.html is prepended as a data url.

from web-view.

kellpossible avatar kellpossible commented on September 3, 2024

Whenever console.log is called in my javascript, the whole html document is printed before the console.log output.

I'm getting the same problem, I want to inline a bunch of code, and it's printing the entire document, which is just silly. But disabling debug mode means I lose access to the developer tools. There needs to be a way to control this.

from web-view.

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.