• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

javascript window opening problem

Engaged ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

i'am trying to open popup window with adding my pageURL.

But not working in my code. what am i wrong? (not open any window)

var pageURL:String = ExternalInterface.call("getPageurl");

more_bmarks..addEventListener(MouseEvent.CLICK, bmClick);

 

function bmClick(event:MouseEvent):void

{

          var address:String = "window.open('http://api.addthis.com/oexchange/0.8/offer?url=','newWin','width=400,height=300,left=0,top=0,toolbar...')";

          var desiredURL:URLRequest = new URLRequest("javascript:"+ address + pageURL +  "void(0);");

          navigateToURL(desiredURL, "_self");

}

TOPICS
ActionScript

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

Trace the value of desiredURL to see if it is a valid URL?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

window.open is a JavaScript method. You cannot use navigateToURL to access JavaScript. You must use ExternalInterface. For example:

ExternalInterface.call("window.open('http://api.addthis.com/oexchange/0.8/offer?url=','newWin','width=400,height=300,left=0,top=0,toolbar...')");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

I checked the code presented using a known url in place of the variables and the popup window appeared, so it appears you can execute the javascript command thru a navigateToURL command.  Testing must be done in a browser.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

Thank you for replay,

In this example same url opened in popUp window. But i need to open popUp window with  http://api.addthis.com/oexchange/0.8/offer?url= + my webpage url.

i'am using this is for social network sharing button. So what i do?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

Try:

ExternalInterface.call("window.open('http://api.addthis.com/oexchange/0.8/offer?url='" + pageURL  + "','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes,fullscreen=No')");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

No, i tested,  this is not working.

pageURL string is in as3 code,  ExternalInterface.call function working in browser.

so this is not working i think.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2012 Aug 10, 2012

Copy link to clipboard

Copied

LATEST

Did you trace the desiredURL yet to see if it is not a valid url address?  If it is, you should be able to paste it into your browser address bar and it will work.

As I already indicated, the code you originally posted does work when I use a known url, but it needs to have a valid url address, and you need to be testing using a browser (on a server would be best).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines