2

For example i want to open HTML files in the browser using python (exactly the webbrowser module ) but i want that page to be in the active tab and only one instance of that page should be opened in the whole web browser.

Here is simple python code that i'm using

import webbrowser

def openWebPage(url):
    webbrowser.open(url)


## before opening the html page i want to make sure 
## it is not opened already, otherwise select it and make it the active tab

openWebPage('/var/www/html/index.html')
ismnoiet
  • 4,129
  • 24
  • 30
  • filter your HTML file list so that there are no copies – R Nar Nov 03 '15 at 23:39
  • But how to achieve that with python ??? – ismnoiet Nov 03 '15 at 23:45
  • you'll have to post some of your code so that i know how you are storing your html files – R Nar Nov 04 '15 at 00:00
  • Storing html files is not an issue i just want to open a web page in the browser. Sorry my friend but i can't understand you question "how they(html files) are stored ? " – ismnoiet Nov 04 '15 at 00:07
  • the way that you worded your question made me think that you already knew how to open html files with webbrowsers. if i am mistaken, please tell me. regardless, if you could post your code to show what you have tried/give me a better idea of how to help you – R Nar Nov 04 '15 at 00:18
  • Yes i know how to open a web page using python, here is a small snippet of code ``import webbrowser`` ``webbrowser.open('path/to/html/file')`` that i'm using – ismnoiet Nov 04 '15 at 00:20
  • i am assuming that you are actually just asking how to access the currently opened tabs on your computer. check this link http://stackoverflow.com/questions/18439564/how-to-keep-track-of-webpages-opened-in-web-browser-using-python using `webbrowser.open(url)` automatically makes it the active tab – R Nar Nov 04 '15 at 00:41

0 Answers0