开发者

Opening and Closing Sized Popup Window Using SafariBrowserWindow Class

Hey -- Having great success using PhoneGap/HTML5 to develop basic iPad apps. However, I'm coming across something I can't quite crack, given my limited Javascript chops, and need help with ASAP.

It's pretty simple functionality in the normal browser world -- I want to popup a window of a given width and height and simply have the ability to close it, even with something as lame as a "Close Window" anchor.

In the normal JS world, of course, I could code both functionalities inline thusly:

<a href="javascript:window.open('URL','name','height=400,width=600');">Open a Window</a>

<a href="javascript:self.close();">Close this Window</a>

and of course this works fine in Safari in the non-iPad world.

Turns out, Apple is encouraging a different approach for new browser w开发者_如何学Cindow opening: the SafariBrowserWindow class whose methods I cannot seem to code properly. And once I "PhoneGap" my normal window.open/close functionality into Xcode, the window.open function DOES work, but not in a modal popup window -- it's a fullscreen window without any ability to size it properly. But far worse, the standard `"javascript:self.close();" doesn't work and I cannot return to my "parent" window without closing down the entire app and re-opening it.

Can someone please provide me an example of how I might code the open/close functionality using the SafariBrowserWindow class? Are exactly-sized popup windows, modal or otherwise, that call external HTML files impossible in the iPad/iPhone world?

Thanks for your help!


You'll need to use the ChildBrowser plugin:

https://github.com/purplecabbage/phonegap-plugins/tree/master/iPhone/ChildBrowser

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜