Is it possible to disable the function window.open in Javascript [duplicate] - javascript

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().

Related

How can I use data from background script in popup? [duplicate]

This question already has an answer here:
Communicate between scripts in the background context (background script, browser action, page action, options page, etc.)
(1 answer)
Closed 5 years ago.
How can I use data from background.js in popup?
What ways are exist to solve this problem?
You can use Message API to communicate between background, popup, content-script and ui-pages.
It is also possible through the localStorage.

Can't open chrome://something with window.open on Chrome [duplicate]

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

Is there any way to define back/forward button effects on a web page? [duplicate]

This question already has answers here:
Javascript : Change the function of the browser's back button
(5 answers)
Closed 8 years ago.
I have a page where the content is delivered mostly though javascript. Hitting the back button would basically exit the page to wherever the user came from instead of showing the previous content. Is there a way to take manual control over what the back/forwards buttons do on a web page?
This is a classic AJAX problem - each page is loaded asynchronously with no new GET from the browser, thus no history.
Look into History API of HTML5 to programatically push page state into the browser history. Other than that you are out of luck.

HTML <a> hyperlink target inPrivate / incognito window [duplicate]

This question already has answers here:
How can we open a link in private browsing mode
(2 answers)
Closed 8 years ago.
Is there a way, via Javascript or other code, to open a url in a private/incognito window from an HTML page? Ideally cross-browser or at the very least IE and Firefox.
The anticipated behaviour would be along the lines of
Link
The simplified reason for this is because admins want to be able to log in as users to preview various pages, but without logging themselves out. Whilst there are various other ways around this issue, this would be the simplest (assuming it is possible).
We can't force the visitor to view the page in an incognito/private window. Browsers provide no API that would make that possible outside of an extension.

javascript to close firefox browser [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to close window in firefox using javascript?
i want to close the main Firefox browser window that a user is browsing my site to close automatically using JS.
i came to know that setting dom.allow_scripts_to_close_windows = true in C:\Program Files\Mozilla Firefox\greprefs\all.js will allow this. Please let me know if it is possible to ovrwirte this value using our Javascript.
By default, a browser will only let you close windows via script which were themselves originally opened via script.
It is not possible to modify that value via JS in your page, and should not be. Imagine the implications of allowing a page to modify user preferences...
No. Websites cannot change the user's preferences.
No, you cannot change a browser configuration via JavaScript.

Categories