问题
My chrome extension is very simple. After the popup is clicked an iframe is loaded. The chrome extension is slightly slow. I click the icon and it takes about a second and a half to load, and I feel like that is too slow. I'd like the popup to show instantly but have the iframe load after.. or perhaps there is an even quicker way... The site that I am iframing only has a textbox visible so in theory the popup should load pretty quickly but I'm just not getting it.
My manifest file basically is:
"browser_action": {
"default_icon": "icon128.png",
"default_popup": "main.html"
},
"background": {
"page": "main.html"
}
回答1:
As any async call, it may take an undeterminable amount of time to return. One clean solution would be to simply add a loading icon to your main.html
. And after the iframe loads simply hide the loading icon.
It should help with the user experience as they'll be able to see at least something right after clicking the icon.
来源:https://stackoverflow.com/questions/28790682/load-chrome-extension-popup-faster