I was trying to develop a Chrome extension that can display me the last 3 news from a soccer news site (obviously the page is not open in any tab), by refreshing every 5 minutes. My ideea was to load the page inside an iframe and, once the page is loaded, access the page DOM and extract only the text nodes with the news. I've tried in many ways using ready and load functions, I tried to follow this solutions here but i always get warnings. My question is: is there a way I can do that without having troubles with cross-domain security? Are there any simple examples i can use?
相关问题
- how to get selected text from iframe with javascri
- Browsers render final comma of right-to-left (rtl)
- Chrome dev tools exact computed value for CSS rule
- Change Chromium icon and “chrome” text to custom i
- debugging webgl in chrome
相关文章
- iframe的里内容看不到,但却点得到
- Is there a way to hide the new HTML5 spinbox contr
- Google Chrome Cache
- how to download a file on Chrome without auto rena
- Do all browsers on iOS use WKWebview or UIWebVIew?
- Why does Google Chrome NOT use cached pages when I
- Calling Chrome web browser from the webbrowser.get
- iframe content disappears on Firefox
Use xhr to load the page and use jQuery or a regex to parse the raw HTML for the data you are looking for.
Keep in mind that the destination site may not want to you access their site in such an automated fashion. Be respectful of their site and resources.
Here's how you could do it using JQuery (please keep in mind I dont know JQuery, just saw this approach somewhere and thought it might work for you).
I put this in a popup and it worked....
And dont forget to put the urls your getting with the xhr stuff in the permissions part of your manifest....
http://code.google.com/chrome/extensions/xhr.html