468,134 Members | 1,231 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,134 developers. It's quick & easy.

How to make an if statement when a particular website is open

TheMono
1 Bit
Hey guys,
I would like to write a script with an if statement that is executed when a specific website is opened by an firefox browser. It should look like that
if NeededURL == URL opened in Browser
...
how can I do this
Thanks in advance
Feb 28 '21 #1
2 2268
SwissProgrammer
206 128KB
I will attempt to help.

This might be at least part of what you are looking for.

You seem to be asking about an action to occur in response to a firefox browser opening a web page; "is executed when a specific website is opened by an firefox browser." That can be complicated, or not.

If you can, then subclass firefox and detect each time that firefox starts to open a new web page. Get the temporary handle (which is not called a handle and I do not recall exactly what it is called) that is created before firefox incorporates that temporary handle into it's overall one (single, no others allowed) handle, and then create an actual handle for that temporary handle and work with that new handle.

You might find it useful to study the following pages about subclassing carefully:
And this is a little different, but it might help if you study it also:
https://pythonexamples.org/python-op...refox-browser/
Mar 4 '21 #2
Niheel
2,418 Expert Mod 2GB
Firefox also has a webRequest API to that allows one to intercept HTTP requests via Browser Extensions
https://developer.mozilla.org/en-US/..._HTTP_requests

This would be done on the browser with the use of Javascript.
This is great as it allows users to disable it when not needed.

To do this at the system level with Python as you are asking would probably require the use of a proxy and filtering requests there or looking at operating system level API's that give access to this.
Mar 5 '21 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Steven Bethard | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.