This question already has answers here:
How to access the webpage DOM/HTML from an extension popup or background script?
(2 answers)
Access global js variables from js injected by a chrome extension
(1 answer)
Closed 5 days ago.
I want to get window object of current tab from popup.js but I can't find a way to do that. i keep getting the popup's window object
I tried just accessing window but it got the popup's window
You need to filter window Types
Doc link method-getLastFocused
chrome.windows.getLastFocused({ windowTypes: ["normal"] }, (win) => console.log(win));
Related
This question already has answers here:
How to open the correct devtools console to see output from an extension script?
(3 answers)
How can I get the URL of the current tab from a Google Chrome extension?
(11 answers)
Closed 2 years ago.
I have an extension that will work only on a given url and I'm using the declarativeContent api to achieve this. When the extension icon is clicked a new popup window that will hold the popup.html will be opened.
I need a way to get the url of the tab that have opened the popup from the popup.js file, I've with chrome.tabs.query but I will get always undefined. Is there a better way?
chrome.tabs.query({
active: true,
lastFocusedWindow: true,
url: 'https://example.com/*' }, (tab) =>{
console.log(tab) // undefined
})
This question already has answers here:
disallow window open in javascript
(2 answers)
Override window.open()
(1 answer)
Closed 4 years ago.
I want to get rid of the window.open function. Is it somehow possible to override or deactivate this function?
I fact a want a browser in which the function window.open is not implemented at all. And I want a browser which is not able to load any resource which comes from another host than that one typed into address bar. (I know that many pages would not work any more in that browser.) But I know I will not get.
Sometime I visit a page that uses window.open by onclick for advertisement. I’m not against advertisement, but against unwanted pop-ups.
I want to inject those pages with my own JS to disable open().
This question already has answers here:
Link to chrome:// url from a webpage
(2 answers)
How to open a page with information about the browser?
(2 answers)
Closed 4 months ago.
Good evening everyone,
I would like to open a window with javascript code.
Usually window.open works fine but the link I provide is chrome://gpu and when I do that, Chrome redirects me to the about:blank page. It happens only with chrome:// links, everything else works fine.
I may understand it is some security issue and Chrome blocks these links to be opened. Do you know if there is a workaround or a setting to allow Javascript to open chrome:// in a new window ?
Thanks a lot,
Clems4ever
This question already has answers here:
Open a URL in a new tab (and not a new window)
(33 answers)
Closed 8 years ago.
Browser settings vary for allowing popups and I want my URL which is called within a JavaScript function to open in a new tab and not be considered a popup.I am opening the url as:
window.open(my_global_link,'_blank');
In IE and FireFox, when I click on the image I get a notification Pop-up blocked and only by Allowing pop-up for the site the URL would open in a separate tab. How can I make it open in a separate tab and not consider it a pop-up?
It is a browser setting . try finding navigation options for new tabs in the browser you are using and set it to open in a new tab instead off a new window.
This question already has answers here:
Access elements of parent window from iframe
(4 answers)
Closed 9 years ago.
Let's say that I've got a page in an iframe.
So...
top page {
iframed page{
}
}
Now, I want to give the iframe page an id.
From within the code on the iframed page, can I check to see if the value of the id of the iframed page is equal to something?
if ($('#iframeid', window.parent.document))
doesn't seem to work.
If it's Chrome or Firefox, you should be able to do:
window.frameElement.id
inside the iframe to get the id of the iframe itself.