I need to download some external urls to a string in a firefox addon.
How can I access the content of external urls for parsing?
To find out the url of the current tab in a firefox addon you can do:
var localString = gBrowser.currentURI.spec;
Then you can parse localString the way you want.
Related
How to scraping the link such as http://bitly.is/heretohelp in tweet and then open the link automatically?
Tweepy gives you access to the Tweet text and conveniently exposing the urls, hashtags, for example to get the URLs within a Tweet:
tweet = api.get_status(id='000001')
print(tweet.entities['urls'])
for url in tweet.entities['urls']:
# t.co url
print(url['url'])
# original url
print(url['expanded_url'])
Once you have the URLs you can decide to do what you want (scrape the target url or open in a browser tab - if you have a web app for example)
I have a Firefox OS app in which I have opened an web page via mozbrowser attribute.
<iframe id="inlineFrameExample"
mozbrowser=true
src="<some external link>"
</iframe>
How can we retrieve DOM content of the iframe?
You can retrieve DOM content via executeScript() method present in Browser API. It will run the script against the iframe and will allow you to do DOM computation tasks.
Note: The example mentioned in the document didn't worked but the syntax given below worked for me. The diff is is passed as string.
iframe.executeScript('put_your_script_here', {origin: 'domain_name'});
I built a new chrome extension and want to remove\hide the URL (chrome-extension://id/).
Any idea how to remove it?
I already tried to do that with History.API and chrome.omnibox
I'm writing an extension in Google chrome and Opera
I need to watch for specific URLs loaded, when i type one url in the address bar.
example:
if i goto www.google.com, it will load couple of other urls / images, etc.. those will be shown in Developer tools->Network.
Is there anyway, i can access that log from my extension background page?
Please let me know
Not really, but you can listen for load events that will fire on the images inside the page:
document.addEventListener('load', function(e){ /* e.target is a newly loaded image */ }, true)
Whether this solves your problem depends on what your use case is exactly..
I'm trying to load myframe.html inside an iframe and attach that iframe to the DOM of the current page. Is this possible, if myframe.html is part of my extension source?
I was thinking something like
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "myframe.html"); //what would be my path here, if this were possible?
document.body.appendChild(iframe);
It should be possible, use a content script to inject javascript into the page and then use the chrome.extension.getURL() method to get the correct URL to your file hosted inside your extension