最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - chrome.runtime.getURL vs. chrome.extension.getURL - Stack Overflow

programmeradmin0浏览0评论

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?

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?

Share Improve this question asked Sep 2, 2015 at 4:54 Dan DascalescuDan Dascalescu 152k64 gold badges332 silver badges419 bronze badges 2
  • 1 Well they can't remove it immediately but should give a grace period in order not to break thousands of extensions (hello Firefox). Maybe someday it'll be gone but not necessarily as it doesn't seem a burden development-wise. – woxxom Commented Sep 2, 2015 at 5:32
  • 1 I'm not saying it should be removed; but it's not even deprecated. Many Chrome extension API calls are deprecated - search for `deprecated at developer.chrome.com/extensions/tabs for example. – Dan Dascalescu Commented Sep 2, 2015 at 5:55
Add a comment  | 

2 Answers 2

Reset to default 15

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.

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.

发布评论

评论列表(0)

  1. 暂无评论