Giter VIP home page Giter VIP logo

Comments (7)

nuthinking avatar nuthinking commented on August 22, 2024

Might not be possible after all :(

http://stackoverflow.com/questions/6643634/focus-omnibar-in-google-chrome

from newtab-redirect.

jimschubert avatar jimschubert commented on August 22, 2024

Also, answered in the wiki under Why doesn't the URL bar focus?

from newtab-redirect.

nuthinking avatar nuthinking commented on August 22, 2024

Ops, sorry about that! Will check if the local page can handle an iframe pointing to a remote page. Thanks!

from newtab-redirect.

nuthinking avatar nuthinking commented on August 22, 2024

Trying with the empty local page still doesn't keep the focus on the address bar :(

from newtab-redirect.

nuthinking avatar nuthinking commented on August 22, 2024

Will try to find the newtab template and see if they do something special there.

from newtab-redirect.

jimschubert avatar jimschubert commented on August 22, 2024

No problem.

If you check out issue #4, I posted directions for tweaking the about:blank example from the chrome extensions developer page and specifying a single page (which loses the ability to update through an options page).

from newtab-redirect.

jimschubert avatar jimschubert commented on August 22, 2024

Will try to find the newtab template and see if they do something special there.

The focus of the address bar is done in-code.

As an example, check out the void Navigate(NavigateParams* params) method here in which the navigation bar losing focus is done:

 // If the user navigated from the omnibox, and the selected tab is going to
  // lose focus, then make sure the focus for the source tab goes away from the
  // omnibox.
  if (params->source_contents &&
      (params->disposition == NEW_FOREGROUND_TAB ||
       params->disposition == NEW_WINDOW) &&
      (params->tabstrip_add_types & TabStripModel::ADD_INHERIT_OPENER))
    params->source_contents->web_contents()->Focus();

Although this is most likely not the exact code preventing the address focus, this is similar to why NewTab Redirect doesn't focus the omnibar. The logical execution of code is:

  • load redirect.html
  • focus omnibar (internal code)
  • get user option (js)
  • set page location (js)
  • render user selected page

There are thousands of other things going on internally in the browser between the time you request a new tab and the time the page you've set in New Tab Redirect's options page actually loads.

from newtab-redirect.

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.