from browser import window

__all__ = ["Error", "open", "open_new", "open_new_tab"]

class Error(Exception):
    pass

_target = { 0: '', 1: '_blank', 2: '_new' }  # hack...


def open(url, new=0, autoraise=True):
    """ 
    new window or tab is not controllable
    on the client side. autoraise not available.
    """
    if window.open(url, _target[new]):
		return True
    return False

def open_new(url):
    return open(url, 1)

def open_new_tab(url):
    return open(url, 2)



@@ -315,16 +315,369 @@
     %22%22%22%0A
+    # javascript window.open doesn't work if you do not specify the protocol%0A    # A solution is the next hack:%0A    if '://' in url:%0A        if url%5B:6%5D == 'ftp://':%0A            print('entro')%0A        else:%0A            protocol = url.split('//:')%5B0%5D%0A            url = url.replace(protocol + '//:', '//')%0A    else:%0A        url = '//' + url%0A    print(url)%0A
     if w

fix some bad behaviour with webbrowser.py module