Christian Biesinger | 1 Sep 02:56 2005
Picon

Re: nsiwindowwatcher->openwindow in new tab

Martin Kremer wrote:
> Does anyone know what I have to pass to nsiwindowwatcher-openwindow to make
> it open the window as a new tab (if the user has tabbed browsing enabled).

That won't work, use nsIBrowserDOMWindow, similar to the code here:
http://lxr.mozilla.org/seamonkey/source/xpfe/bootstrap/nsNativeAppSupportWin.cpp#2340

Probably you wouldn't pass LOAD_EXTERNAL in your case.

Note that this requires Gecko 1.8, afaik.
See also 
http://lxr.mozilla.org/seamonkey/source/dom/public/idl/base/nsIBrowserDOMWindow.idl#45

-biesi
Hitesh Khamesra | 1 Sep 14:54 2005

Re: Convert HTML string into a DOM document for manipulation

>>   iframe.contentDocument.open();
This piece of code giving me "null" exception in following version of mozilla
    SeaMonkey 1.0a mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20050201
It seems to me, contentDocument.open() is not supported now. 
 
is there any alternate for that, or I am doing something wrong.
 
Thanks,
-hitesh.

>>   iframe.contentDocument.write(htmlMarkup);
>>   iframe.contentDocument.close();
>
> Hi martin,
>             Really thx for your help for converting a html string into DOM
> for manipulation. Appreciate very much! The code works but right now i need
> to render the DOM so i can find the x and y coord of all the html tags. Do
> you have any idea of how to display/render this DOM ? I try using the one
> below but it only can render a html file or url
> "Martin Honnen" <mahotrash <at> yahoo.de> wrote in message
> news:da1091$3g1 <at> ripley.netscape.com...
>>
>>
>> Ken Theng wrote:
>>
>>> Yep , you are right ! I tried that but does not work cos it doesnt
>>> support text/html. Do u have any idea how to do it ?
>>
>> As far as I understand there is currently no API in Mozilla to simply
>> parse a string as HTML into a DOM document, all HTML parsing is somehow
>> tied to rendering and laying out documents always doing stuff like loading
>> stylesheets and loading and executing scripts.
>> But that is an understanding based solely from earlier responses in
>> newsgroups so not a very qualified one. I think Boris is back in July, he
>> can tell you more on such stuff.
>>
>> All I could contribute to a solution is script creating an (X)HTML iframe
>> element, inserting it into an existing document and then using
>> document.write to have the HTML string parsed e.g.
>>
>> function parseHTML (htmlMarkup) {
>>   var iframe = document.createElementNS('http://www.w3.org/1999/xhtml',
>> 'iframe');
>>   iframe.style.display = 'none';
>>   if (document.body) {
>>     document.body.appendChild(iframe);
>>   }
>>   else {
>>     document.documentElement.appendChild(iframe);
>>   }
>>   iframe.contentDocument.open();
>>   iframe.contentDocument.write(htmlMarkup);
>>   iframe.contentDocument.close();
>>   return iframe.contentDocument;
>> }
>>
>> var doc = parseHTML([
>>   '<html>',
>>   '<head><title>test</title></head>',
>>   '<body><p>Kibology for all.</p></body>',
>>   '</html>'
>> ].join('\r\n'));
>>
>> // now use doc here
>>
>> --
>>
>> Martin Honnen
>> http://JavaScript.FAQTs.com/
>
>
> _______________________________________________
> mozilla-dom mailing list
> > http://mail.mozilla.org/listinfo/mozilla-dom
Martin Honnen | 1 Sep 15:41 2005
Picon

Re: Convert HTML string into a DOM document for manipulation


Hitesh Khamesra wrote:

>  >>   iframe.contentDocument.open();
> This piece of code giving me "null" exception in following version of 
> mozilla
>     SeaMonkey 1.0a mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; 
> rv:1.8a5) Gecko/20050201
> It seems to me, contentDocument.open() is not supported now. 

I would rather guess that you have not inserted iframe into a document. 
Note that the original script has
   document.body.appendChild(iframe);
before the access to iframe.contentDocument is attempted.

--

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
Hitesh Khamesra | 1 Sep 17:40 2005

Re: Convert HTML string into a DOM document for manipulation

 
>
>
> Hitesh Khamesra wrote:
>
>>  >>   iframe.contentDocument.open();
>> This piece of code giving me "null" exception in following version of
>> mozilla
>>     SeaMonkey 1.0a mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
>> rv:1.8a5) Gecko/20050201
>> It seems to me, contentDocument.open() is not supported now.
>
> I would rather guess that you have not inserted iframe into a document.
> Note that the original script has
>   document.body.appendChild(iframe);
> before the access to iframe.contentDocument is attempted.
I used whole scipt.....
<code>
function parseHTML (htmlMarkup) {
  var iframe = document.createElementNS('http://www.w3.org/1999/xhtml', 
'iframe');
   iframe.style.display = 'none';
   if (document.body) {
    document.body.appendChild(iframe);
   }
   else {
     document.documentElement.appendChild(iframe);
   }
   iframe.contentDocument.open();
   iframe.contentDocument.write(htmlMarkup);
   iframe.contentDocument.close();
   return iframe.contentDocument;
 }
</code>
Martin Honnen | 1 Sep 19:42 2005
Picon

Re: Convert HTML string into a DOM document for manipulation


Hitesh Khamesra wrote:

>  >> This piece of code giving me "null" exception in following version of
>  >> mozilla
>  >>     SeaMonkey 1.0a mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
>  >> rv:1.8a5) Gecko/20050201
>  >> It seems to me, contentDocument.open() is not supported now.

Is there any reason you test that with some alpha build from 20050201?
Does the problem occur with release builds or with a recent nightly as well?

> I used whole scipt.....
> <code>
> function parseHTML (htmlMarkup) {
>   var iframe = document.createElementNS('http://www.w3.org/1999/xhtml', 
> 'iframe');
>    iframe.style.display = 'none';
>    if (document.body) {
>     document.body.appendChild(iframe);
>    }
>    else {
>      document.documentElement.appendChild(iframe);
>    }
>    iframe.contentDocument.open();
>    iframe.contentDocument.write(htmlMarkup);
>    iframe.contentDocument.close();
>    return iframe.contentDocument;
>  }
> </code>

When I wrote that script I tried to allow it to work in HTML as well as 
XHTML and XUL documents but I have never tested for instance whether 
that works if the document in the above code is a XUL document.
In what context do you call the script, what is your document?

--

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
Qian Su | 3 Sep 10:18 2005
Picon

How to use nsIWindowWatch->OpenWindow to open a regular fully functional browser window?

Hi,
 
I am trying to open a new regular browser window through the call below:
 
// OpenWindow(nsIDOMWindow *aParent, const char *aUrl, const char *aName, const char *aFeatures, nsISupports *aArguments, nsIDOMWindow **_retval);
 
rv = pWindowWatcher->OpenWindow(nsnull, url, default_window_name, "chrome,dialog=no,all,width=800,height=600", nsnull, &newWindow);

the window is opened successfully, however, this window does not have the menu bar or navigation bar.  Also, when I tried to invoke Back() or Forward() on such a window, it failed to do so:

nsCOMPtr<nsIDOMWindowInternal> domWindowInternal;

domWindowInternal = do_QueryInterface(domWindow, &rv);

// the following line fails...

rv = domWindowInternal->Back();

Any ideas as for how I may open a regular window with all features? I tried to leave the 'aFeatures' param empty, but still I can't get the menu bar or navigation bar.

Thanks!

Qian

 

Delta | 3 Sep 16:27 2005
Picon

Doesn't work on Mozilla

Hi,

I made a drop-down menu full compatible with ASP.NET and VB.NET

It works fine on IE6, but on Mozilla the drop-down menu hides when you hover 
a link from the list. It actually works even worse in Opera, the menus don't 
drop down at all.

The "Microsoft only code" I use is filter:opacity, but this is inoffensive 
to the behaviour of the menu.

The problem, I think, is in how Explorer interprets onmouseover an 
onmouseout

The menu is working here :

The only link it works is the Home Button

pwp.netcabo.pt/falmartins/index.htm

Thank you for any help
Martin Honnen | 3 Sep 18:16 2005
Picon

Re: Doesn't work on Mozilla


Delta wrote:

> I made a drop-down menu full compatible with ASP.NET and VB.NET

> It works fine on IE6, but on Mozilla the drop-down menu hides when you hover 
> a link from the list. It actually works even worse in Opera, the menus don't 
> drop down at all.

The problem is not so much the HTML and script for the menu itself but 
the iframe you have put in the document below the menu (respectively the 
HTML table which you use for the menu).

> pwp.netcabo.pt/falmartins/index.htm

If you remove that iframe then the menu displays and works with Mozilla 
1.7 and Opera 8.
What you are trying to achieve is not possible across browsers in a 
reliable way, you want to have a menu created in one document overlap 
the contents of a document in another frame, that iframe.
Even with older IE/Win version (e.g. IE 5) you would have that problem.

With the upcoming Firefox 1.5 the menu over the iframe will work but the 
whole design of that page with the menu and the iframe where the menu is 
supposed to overlap the iframe should be changed to not use an iframe if 
you target the web in general, as said various browsers and browser 
versions have their own way when it comes to iframes.

--

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
Delta | 4 Sep 15:26 2005
Picon

Re: Doesn't work on Mozilla

Thank you

I came up with another solution

It works fine on IE6 and Mozilla 1.0.6, don't know others

:)))

Don't forget to make refresh in case you have cached the site

http://pwp.netcabo.pt/falmartins/index.htm

"Martin Honnen" <mahotrash <at> yahoo.de> wrote in message 
news:dfci8i$d511 <at> ripley.aoltw.net...
>
>
> Delta wrote:
>
>> I made a drop-down menu full compatible with ASP.NET and VB.NET
>
>> It works fine on IE6, but on Mozilla the drop-down menu hides when you 
>> hover a link from the list. It actually works even worse in Opera, the 
>> menus don't drop down at all.
>
> The problem is not so much the HTML and script for the menu itself but the 
> iframe you have put in the document below the menu (respectively the HTML 
> table which you use for the menu).
>
>
>> pwp.netcabo.pt/falmartins/index.htm
>
> If you remove that iframe then the menu displays and works with Mozilla 
> 1.7 and Opera 8.
> What you are trying to achieve is not possible across browsers in a 
> reliable way, you want to have a menu created in one document overlap the 
> contents of a document in another frame, that iframe.
> Even with older IE/Win version (e.g. IE 5) you would have that problem.
>
> With the upcoming Firefox 1.5 the menu over the iframe will work but the 
> whole design of that page with the menu and the iframe where the menu is 
> supposed to overlap the iframe should be changed to not use an iframe if 
> you target the web in general, as said various browsers and browser 
> versions have their own way when it comes to iframes.
>
> -- 
>
> Martin Honnen
> http://JavaScript.FAQTs.com/ 
Christian Biesinger | 5 Sep 01:34 2005
Picon

Re: How to use nsIWindowWatch->OpenWindow to open a regular fully functional browser window?

Qian Su wrote:
>  rv = pWindowWatcher->OpenWindow(nsnull, url, default_window_name, 
> "chrome,dialog=no,all,width=800,height=600", nsnull, &newWindow);

Don't pass "chrome" if you want a browser window.

Gmane