I am developing a chrome extension and I want to know that is there a function/way that allows me to type and also select text and the extension should stay open? Normally when I Use the extension popup and I Click outside the extension close. Is there a way to avoid this? Thanks in advance
Related
here is my problem :
What I want :
I'm wondering if it's possible to have access (to change them) to renderings settings from an extension in Chrome. I know some APIs exist like DevTools API but I cannot find a way to change any of these rendering settings from my extension.
Rendering tab in DevTools
What I want more specifically :
I made a Chrome extension and I want it to make a specific tab think it's focused, even if it's not.
I know I can do it manually by opening Chrome DevTools panel and enabling "Emulate a focused page" but I really want my extension to do it programmatically.
Why I want to do this :
Some websites don't behave the same when the page is not focused, so I want my extension to make their behavior consistent.
Do you think it is possible ? Thx :)
I've been searching online for a week now and I really can't find any solution to my problem...
I have created a webpage that works best with Chrome. If the user opens this page from Safari, I want to put a button that says "Click here to open this page in Chrome". Upon clicking this button, Chrome should fireup and load the specified URL.
Is there a way to do that? Or even just to launch Chrome from Safari?
There actually is a way, if you want to do this, make the button, and set the href to the link, but at the beginning, delete ‘https://‘ and replace it with ‘googlechromes://’, for example ‘googlechromes://YouTube.com’ if you go to that link in safari, it will ask, “do you want to open this page in chrome?” And if you click yes it will open chrome over safari
There is no way to this within the browser, but here a few work-arounds. You could ...
Make a button to copy your URL to their clipboard so they can paste it in Chrome
Send the user to a download link if they don't have chrome (just ask them if they have chrome or not)
Close the tab in the browser after the URL is copied
You could use window.close() or just close(), as pointed out in this answer.
These are just some thoughts. It's the best anyone could do for a problem like this. I hope this helps.
I couldn't find any similar question to this, but is it possible to create a new tab within chrome extension (using chrome.tabs.create) and then after closing it using the same extension prohibit user from reopening it using ctrl+shift+t or undo close tab command?
You can open an incognito tab; it will have the requested behavior.
I don't think you can clear session data, and simply clearing history does not prevent reopening.
I need to upload image with chrome extension, when file browser is clicked the extension popup closes. How can I handle both the file browser and popup to remain open.
It's a tricky question to answer.
The basic idea is that whenever the popup window loses focus, it is supposed to immediately close, which entails the destruction of the popup's JavaScript context (and your logic breaks as a result). This is not something you can influence.
Modal dialogs such as the file input ought to be an exception, but that doesn't work consistently across all platforms Chrome runs on. Evidence: question, bug.
Whenever you want something to survive popup closing, you normally put it in the background page. This lead to this workaround that places the File input in the background page and triggers its selection from the popup. But there's (unconfirmed) evidence that this does not work anymore. The question above has another, supposedly working answer by injecting the input tag into the current page, but that's subject to failing on "unscriptable" pages such as Chrome Web Store or internal chrome:// pages.
The safest way would be to open a separate tab or popup window to handle the process. This is obviously awkward UX though.
Not sure if you'd actually want to do this, but if you have a small app and it's not a main feat (or you've got high hopes of chrome dev's solving this issue) - as a temp solution you can ask your users to open dev tools while uploading files, popup won't close.
Though you're better off putting your logic into a separate file (eg 'background.html') and opening it from popup as a tab like this:
chrome.tabs.create({url: chrome.extension.getURL('background.html')});
I have a chrome extension which hooks into the devtools. Ideally I want a badge that, when clicked, opens up the devtools on the new tab which I created. Is there any way to do this from the background page?
It seems unlikely that this is possible or will ever become possible,
check this:
https://code.google.com/p/chromium/issues/detail?id=112277
which says:
"We only allow explicit devtools opening."
Yes you can (or not) using the experimental APIs chrome.experimental.webInspector.
http://code.google.com/chrome/extensions/experimental.html
You can even change the content and panels of it.
Note that you will not able submit extensions that use experimental APIs.
There is no way to do that.
The chrome://chromewebdata link only works if an instance of DevTools is already opened.
This is quite old but since I stumbled upon it now searching for a solution I figured others might have too. Since Chrome 28 you can use the devtools.* API. This allows you to open and manipulate DevTools panels. It is also notable no longer expirimental.
One could try
chrome.developerPrivate.openDevTools
Perhaps, the extension could kick off a Selenium script and you could use the "send_keys()" function as something like this:
ActionChains(driver).key_down(Keys.CONTROL).key_down(Keys.SHIFT).\
send_keys('J').key_up(Keys.CONTROL).key_up(Keys.SHIFT).perform()
... as "Ctrl+Shift+J" is the default keybind to open dev-tools (as of Jul 08, 2021)
It's not impossible with side extension, but if the reason is that you've tired to click Ctrl + Shift + I again and again every time - you can simply open the right button menu on needed page and select "Inspect" from it, it'll open the console like extension button, and also you don't need to search for its icon every time you need it, which is more conviniently than using an extension.