javascript - Chrome Extension XMLHttpRequest Can't open same-window link -


i making chrome extension scraper im working on control etc.. have login script here:

<?php      $username = $_get['username'];     $password = $_get['password'];      $pass = sha1($password);      $mysql = new mysqli("*" , "*" , "!!*" , "*");      $data = $mysql->query("select * `staff_section`.`logins` `staff_name` = '$username' && `staff_pass` = '$pass'");      echo $data->num_rows;      $mysql->close();     unset($data);  ?> 

and have launch.js file here:

chrome.app.runtime.onlaunched.addlistener(function(){         chrome.app.window.create('window.html' , {             'outerbounds': {                 'width' : 720,                 'height' : 720             } ,              frame: 'none'         });         get("loginform").addeventlistener('submit' , function(){             checklogin(get("username").value , get("password").value);         }); }); function checksession(){         if(session.getsession("authorized") == false){             //do nothing         }else{          }         }         function checklogin(username , password){             var xmlhttp = new xmlhttprequest();             xmlhttp.open("get" , "http://192.168.4.240/chrome_app_server/ajax/login.php?username=" + username + "&password=" + password , false);             xmlhttp.send();             if(xmlhttp.responsetext == "1"){                 session.start();              }else{                 alert("incorrect credentials");             }         }         function get(id){             return document.getelementbyid(id);         } 

and window.html file here:

<html>     <title></title>     <script src="js/launch.js"></script>     <script src="js/session.js"></script>     <style>      </style>  <body bgcolor="#404040">     <div style="position:absolute;top:0px;left:0px;width:100%;height:50px;background:#171717;">         <img src="img/jejamesicon.ico" style="position:absolute;top:10px;left:10px;" width="30" height="30"/>         <p style="position:absolute;top:17.5px;left:55px;color:#fff;font-family:verdana;margin:0px;"></p>     </div>     <div style="position:absolute;top:60px;left:10px;right:10px;bottom:10px;text-align:center;">         <form id="loginform">             <input type="text" id="username" placeholder="username"/>             <input type="password" id="password" placeholder="password"/>             <input type="submit" value="log in"/>         </form>     </div> </body> 

when try making login xmlhttprequest is:

  can't open same-window link "chrome-extension://iflddlelmkkkeoehpghlblcmkkbgacpp/window.html?"; try target="_blank". 

why cant make xmlhttprequests? have set permission in manifest:

{     "manifest_version" : 2,     "name": "j e james scraper",     "description" : "j e james cycles scraper gui",     "version" : "1.0",     "app" : {         "background" : {             "scripts" : ["js/launch.js"]         }     },     "icons" : {         "128" : "img/icon.png"     } ,      "permissions" : [         "http://192.168.4.240/*"     ] } 

so why isnt scraper working, login script stored on specified url above


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -