Google Extension and PHP

旧巷老猫 提交于 2020-01-07 02:03:08

问题


Is it possible to include a PHP file inside a Google Extension? If so, how do I do it?

Here's my manifest:

{
  "name": "My very first extension",
  "version": "0.1",
  "description": "My first extension",
  "content_scripts": [
    {
      "matches": ["http://jquery.com/*"],
      "js": ["jquery.js", "content.js"]
    }
  ],
  "browser_action": {
    "default_icon": "logo.png",
    "popup" : "index.html"
  },
  "permissions": [
    "http://api.flickr.com/"
  ]
}

So I have jQuery included and it seems to be working, so in my index.html I have this javascript:

var html = $.ajax({
  url: "ajax.php",
  async: false
 }).responseText;

Is there a way to include ajax.php and query it?

This is my first one, forgive me if this is a simple problem, but Google doesn't seem to produce any topics on this one,

Thanks!


回答1:


You can put php file into extension folder and read it from javascript as a text file (from a background page), you can't run that php code though.



来源:https://stackoverflow.com/questions/4878433/google-extension-and-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!