added js that handles cross domain