2 years ago

#50164

test-img

Amine Messaoudi

webbrowser does not open links in the same window if it's incognito

I'm using Django to open some links in the same window, using webbrowser.

I wrote a custom action like this :

@admin.action(description='Open')
def open(modeladmin, request, queryset):
    for app in queryset.filter(auto_open=True).reverse():
        webbrowser.open(app.link, new=0, autoraise=True)

This is what happens when I check which links to open and click on Go :

  • If the window where the click originated is not incognito, it works fine, links are opened in the same window

  • If the window where the click originated is incognito, it does not work and links are opened in a non incognito window

What I'm trying to do here is to make sure that links will be opened in the same window, regardless if it's incognito or not. Is this browser specific ? Because I'm using Chrome and I don't know if I have to override settings or not

python

django

python-webbrowser

0 Answers

Your Answer

Accepted video resources