Added a testcase and put the js loading code inside the head tag