Reputation: 349
On my raspberry pi, I have my HTML/CSS/JavaScript page up and running in a web browser. I have python interacting with the GPIO pins on my raspberry pi. After a certain event happens involving the GPIO pins, I want the python script to change the page in the web browser. I have already tried:
webbrowser.open('websitehere.com', new = 0)
Unfourtunately, that did not work for me and just opened a new window. I could just open another tab and close the previous tab but I really do not want to do that. I was wondering if there was a way to have the python script tell my javascript what happened and have my JavaScript change to one of the other html files that I have. Thanks.
Edit: and no. it is not missing the http or anyting. I even tried it like this(since I have the html files on my computer) and it still does not work:
import time
import webbrowser
webbrowser.open('C:\Users\iJason\Documents\Smart_Calendar\Smart_HTML\Calendar.html')
time.sleep(3)
webbrowser.open('C:\Users\iJason\Documents\Smart_Calendar\Smart_HTML\Ads.html', new = 0)
Let me know if there is another problem. If not, I am going to start using the solution of using Selenium. thanks!
Edit 2: Ok, so this is a common problem: Am I using the webbrowser.open() wrong, or does it not work as advertised? (Python)
It has to do with the way the browser is configured. But I am not sure how to change the way the browser is configured so that doing this command will work.
Upvotes: 0
Views: 242
Reputation: 5632
As Ukimiku stated, please try:
webbrowser.open('http://websitehere.com', new = 0)
Upvotes: 1