make the app work for chrome extension and regular page