chrome.runtime.getURL vs. chrome.extension.getURL

陌路散爱 提交于 2020-01-02 02:37:09

问题


What are the differences between chrome.runtime.getURL and chrome.extension.getURL?

The documentation implies that chrome.runtime.getURL works in both apps and extensions, and this 2012 announcement indicates that some APIs (though not getURL) have moved from chrome.extension to chrome.runtime.

What's the point of chrome.extension.getURL then, and why isn't it deprecated in favor of chrome.runtime.getURL?


回答1:


The chrome.extension.getURL is now deprecated, you should use chrome.runtime.getURL.

From the chrome.extension.getURL's docs:

Deprecated since Chrome 58. Please use runtime.getURL.




回答2:


There isn't any, really.

There are some similar functions there with differences, like .getBackgroundPage, but in this case there's no effective difference.

And as you said yourself, it's not deprecated either. Why? Maybe just overlooked. extension API is older than runtime.



来源:https://stackoverflow.com/questions/32344868/chrome-runtime-geturl-vs-chrome-extension-geturl

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