Skip to main content
Participant
December 10, 2009
Question

problem in retreiving browser url

  • December 10, 2009
  • 1 reply
  • 363 views

Hello,

I want to reterive the browser url where my swf is embedded in actionscript 3. I have written the following code which is working in Firefox and Safari but it doesn't work on IE and chrome. Please anyone help me out.

getURL.swf

public function getURL()
  {  
   var pageURL:String = ExternalInterface.call('window.location.href.toString');     
     
   ExternalInterface.call('showAlert', pageURL);    
  }

HTML

html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>getURL1</title>
<script language="javascript">
function showAlert(url)
{
  alert(url);
}
</script>

</head>
<body>
<embed src="getURL.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="getURL1" align="middle" allowScriptAccess="sameDomain"      allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</body>
</html>

This topic has been closed for replies.

1 reply

December 10, 2009

Hi,

I check it up. It works fine.

I attached the file for reference.

Saransoft

rich2sonuAuthor
Participant
December 11, 2009

Hii Saransoft

Actually the AC_RunActiveContent.js file is included in the html file you have given, which we can't include. The swf will be embedded using only <embed> tag in different external sites which I have worked on and I need to track the broswer url.

So i will have only this embedded in sites -

<embed src="Stage.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="Stage" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

So the external sites are not under my control where i will include this js file.

Without including its working in all, except IE browsers.

I hope you are getting the issue.

December 11, 2009

Hi,

Yes except IE all the other works fine.

but we include the AC_RunActiveContent.js file

then it works in all the browsers.

Saransoft