Flex interactive operations on browsers

Source: Internet
Author: User

Through its unique features, flex can communicate with browsers and demonstrate related operation encapsulation classes.

Package COM. shine. framework. browser {import COM. shine. framework. core. util. arraymap; import flash.net. URLRequest; import flash.net. navigatetoURL; import MX. managers. browsermanager; import MX. managers. ibrowsermanager; import MX. utils. urlutil; public class browserutils {public function browserutils () {}// set the browser title public static function setbrowsertitle (value: string): void {browsermanager. getinstance (). settitle (value);} // obtain all the URLs of the browser static function getbrowserfullurl (): String {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); Return BM. URL;} // obtain the URL without the URL public static function getbrowserbaseurl (): String {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); Return BM. base;} // obtain the current browser URL protocol public static function getbrowserprotocol (): String {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); Return urlutil. getprotocol (BM. URL);} // obtain the current browser URL Port Public static function getbrowserport (): int {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); Return urlutil. getport (BM. URL);} // obtain the name of the current browser URL server public static function getbrowserservername (): String {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); Return urlutil. getservername (BM. URL);} // modify the current urlpublic static function updatebrowserurl (value: arraymap): void {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); var O: Object = urlutil. stringtoobject (BM. fragment); var num: Int = value. getlength (); For (var I: Int = 0; I <num; I ++) {o [value. getkeybyindex (I)] = value. getvaluebyindex (I);} BM. setfragment (urlutil. objecttostring (o);} // obtain the URL server name and port public static function getbrowserserverwithport (): String {var BM: ibrowsermanager = browsermanager. getinstance (); BM. init (); Return urlutil. getservernamewithport (BM. URL);} // refresh the public static function refreshbrowser (): void {navigatetoURL (New URLRequest ("javascript: location. reload (); ")," _ Self ") ;}// close the public static function closebrowser (): void {navigatetoURL (New URLRequest (" javascript: window. close () ")," _ Self ");}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.