How can I open an URL in a hidden tab in Firefox - firefox-addon

I'm developing a Firefox add-on and want to get the document content (DOM Elements) of an URL for parsing some data but don't want user to see this action. Is there any way to open an URL in a hidden tab and get the document content of this tab? Or any other solution?

you could use Javascript to do that. Have a closer look at the xmlhttpRequest function.
http://en.wikipedia.org/wiki/XMLHttpRequest

Related

Can the text in a URL make the link open in a new window?

I know that you can use html to open a link in a new page using target="_blank". Is it possible to add something similar to the end of a URL to make the link open in a new browser window (or tab)?
It is not possible to add something to the end of the URL to have it open in a new window or tab. Whether or not the URL opens is in a new windows is controlled by the browser, not by the URL itself.
The only type of URL that has the power to specify a new window open is is javascript: URL. If you could modify both the beginning and the end of the the URL, you might be able to embed it in JS. However that only has the ability to open a pop-up window, not a new tab. Pop-up blockers usually block this code these days.
javascript:window.open('https://example.com/','window-name');return false;

jquery-mobile dialog without hash change

I am new to jquery mobile. I want to open a dialog containing external page as content. At the same time not want to change hash in url.
I have link
Open dialog
which opens the dialog but changes the hash in url. Need help, thank in advance
From official docs:
Since dialogs are typically used to support actions within a page, the
framework does not include dialogs in the hash state history tracking.
This means that dialogs will not appear in your browsing history
chronology when the Back button is clicked.
http://api.jquerymobile.com/dialog/

Using pushState/replaceState to change the url in jQuery-Mobile

I'd like to change my jQM page's URL dynamically (when the user does some action) in order to modify the query string. Using history.pushState works fine, but when jQM tries to add a hash to the URL, for example when navigating to a dialog, things don't work as expected: the URL reverts to its original value, and jQM appends the hash to that (not to mention that an error occurs when I try to dismiss the dialog).
I looked into the jQuery Mobile docs and, from what I understood, the original URL of a page is stored in the data-url attribute of the data-role="page" element. So I tried modifying that as well whenever I need to change my URL, but it still reverts back to the original one when a dialog is opened.
Check this JS Bin for an example: http://jsbin.com/egunif/5/edit
When clicking the "Dialog" button, the URL is changed (along with the data-url attribute) and then the dialog is opened. You can see that the url briefly changes to egunif/hashtest before jQM changes it to egunif/5#&ui-state=dialog.
So it seems that the original URL is being stored somewhere else, the question is where? And is it possible to change this URL so that there are no conflicts when jQM makes hash changes to it?
Thanks!
What I wound up doing was just setting the url back to its original value whenever I change page to a dialog (in a pagebeforechange handler), then re-replacing it with the new value when coming back to the page (in a pagechange handler).
I still get an error in the browser's debug console due to an empty hash value (possibly something to do with this issue), but it's not affecting the functionality of the site, so I'll leave it for now. I'm still open to better suggestions though!
Update:
In the 1.2.0 Final version of jQM, popups were introduced, along with the option to disable hash changing by setting data-history="false" on the popups. By replacing all my dialogs with popups, I am able to manipulate the url without having to worry about conflicting with
jQM.

How do I create a button within the jQueryMobile framework and have it call the URL but not do anything on the page?

How do I create a button within the jQueryMobile framework and have it call the URL on the remote server but not do anything on the page?
I have a web enabled device that accepts commands in the form of http://deviceip/index.htm?cmd=xxxx
The url doesn't return any data or at least any data that I want to display. Calling the url causes the device to do something (i.e. turn a light on or off etc..)
In the old days I'd create a hidden Iframe and set it as the button's target I'm pretty sure that is really the wrong way to do it.
<div class="ui-block-a">On</div>
How do I make the above call the url but not do anything?
Call the URL using ajax:
On

Clicking relative link goes to about:<relative link> which does not show wanted page

I am using version 14.67.9 of TembeddedWB in a project in delphi 2007. I use TembeddedWB in combination with loadfromstring. That all works like I want it to but when clicking on a link in the page it goes to a page I am not expecting. If for instance the page is on a particular IMDB result site and one clicks on the link the browser goes to about:/title/tt1041829/. I guess I forgot to set some extra property or I am doing something else wrong. If somebody here can point me in the right way i would appreciate that.
It looks like the browser's current URL is not updated and the default "about:blank" is used. I guess this may happen when you don't navigate to the web site directly by Navigate or Navigate2 method but load the HTML from a local file or stream.
Edit: I see, you are using LoadFromString which confirms that.
In that case, it should be possible to use OnBeforeNavigate2 event to fix the URL.
The problem is that the web page you are accessing uses relative links and the reference point that it would be relative too is your loadfromstring which loads through the "about:blank" page. Another way of fixing this would be to inject a &LT;BASE href="http://www.originaldomain.com/originalpath"&GT; tag in the HTML header (between the &LT;HEAD&GT; and &LT;/HEAD&GT; tags) which points to the location the page was accessed from. This will tell the browser where relative tags start from and will fix the problem without requiring inspection of every link.

Resources