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

specific url blocking

Engaged ,
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

this is specific url blocking.

But not woking this.....

function pageDomainCheckInit(event:Event):void {

          var url:String=stage.loaderInfo.url;

          var urlBeginninng:Number=url.indexOf("://")+3;

          var urlTermination:Number=url.indexOf("/",urlBeginninng);

          var pageDomain:String=url.substring(urlBeginninng,urlTermination);

          var LastDot:Number=pageDomain.lastIndexOf(".")-1;

          var CharacterAfterDomain:Number=pageDomain.lastIndexOf(".",LastDot)+1;

          pageDomain=pageDomain.substring(CharacterAfterDomain,pageDomain.length);

          if (pageDomain!="www.somedomain.com/test/index.swf") {

                    warning_txt.text="This file is running on the wrong pageDomain. Content Access Restricted!";

                    closeBoxTop.visible = true;

          } else {

                    warning_txt.text="Yes Player Visible";

                    closeBoxTop.visible = false;

          }

          stage.removeEventListener(Event.ENTER_FRAME, pageDomainCheckInit);

}

 

stage.addEventListener(Event.ENTER_FRAME, pageDomainCheckInit);

TOPICS
ActionScript

Views

1.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
Guest
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

have u compared this

   if (pageDomain!=www.somedomain.com/test/index.swf) {

if yes then use this

   if (pageDomain!='www.somedomain.com/test/index.swf') {

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 ,
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

i'm already put it. i selected xml text on top text edit options so..." " are missed.

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
Advocate ,
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

I would suggest tracing out the value of pageDomain before your if statement to make sure it's what you think it is

I have worked this out in my head so excuse any mistakes

as you can see from my comments I think pageDomain will be something like somedomain.com and you are comparing it to "www.somedomain.com/test/index.swf"

// assume url = http://www.somedomain.com/test/index.swf

function pageDomainCheckInit(event:Event):void {

          var url:String = stage.loaderInfo.url;

          // url = http://www.somedomain.com/test/index.swf

                     

          var urlBeginninng:Number = url.indexOf("://") + 3;

          var urlTermination:Number=url.indexOf("/",urlBeginninng);

          var pageDomain:String = url.substring(urlBeginninng, urlTermination);

          // pageDomain = www.somedomain.com

                     

          var LastDot:Number=pageDomain.lastIndexOf(".")-1;

          var CharacterAfterDomain:Number = pageDomain.lastIndexOf(".", LastDot) + 1;

          pageDomain = pageDomain.substring(CharacterAfterDomain, pageDomain.length);

          // pageDomain = somedomain.com

          if (pageDomain!="www.somedomain.com/test/index.swf") {

                    warning_txt.text=This file is running on the wrong pageDomain. Content Access Restricted!;

                    closeBoxTop.visible = true;

          } else {

                    warning_txt.text=Yes Player Visible;

                    closeBoxTop.visible = false;

          }

          stage.removeEventListener(Event.ENTER_FRAME, pageDomainCheckInit);

}

 

stage.addEventListener(Event.ENTER_FRAME, pageDomainCheckInit);

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 ,
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

if i put :   if (pageDomain!="somedomain.com")

that is woking.

but i want spacific url blocking like  "www.somedomain.com/test/index.swf"

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
Advocate ,
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

then you need to change this code to extract the exact domain you want

          var url:String = stage.loaderInfo.url;
          var urlBeginninng:Number = url.indexOf("://") + 3;
          var urlTermination:Number=url.indexOf("/",urlBeginninng);
          var pageDomain:String = url.substring(urlBeginninng, urlTermination);
                     
          var LastDot:Number=pageDomain.lastIndexOf(".")-1;
          var CharacterAfterDomain:Number = pageDomain.lastIndexOf(".", LastDot) + 1;
          pageDomain = pageDomain.substring(CharacterAfterDomain, pageDomain.length);

e.g. if you want to accept only "www.somedomain.com/test/index.swf"

then simply use something like

function pageDomainCheckInit(event:Event):void {

          var url:String=stage.loaderInfo.url;

          if (url != "www.somedomain.com/test/index.swf") {

                    warning_txt.text="This file is running on the wrong pageDomain. Content Access Restricted!";

                    closeBoxTop.visible = true;

          } else {

                    warning_txt.text="Yes Player Visible";

                    closeBoxTop.visible = false;

          }

          stage.removeEventListener(Event.ENTER_FRAME, pageDomainCheckInit);

}

different modifications will be needed if you want

only "www.somedomain.com/test/"

or "www.somedomain.com/"

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 ,
Mar 22, 2012 Mar 22, 2012

Copy link to clipboard

Copied

only   "www.somedomain.com/test/"

or any other script.

finally i put this:  (url != "http://www.prasaar.com/dev/trials/vss/index.swf");

this is woking.

how to validate "http" ?

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
Advocate ,
Mar 23, 2012 Mar 23, 2012

Copy link to clipboard

Copied

what do you mean validate http?

you want to test against www.prasaar.com/dev/trials/vss/index.swf rather than http://www.prasaar.com/dev/trials/vss/index.swf?

play around with the string manipulation and trace out the final pageDomain until it's in the format you want

use something like this:

function pageDomainCheckInit(event:Event):void {
          var url:String = stage.loaderInfo.url;
                     
          var urlBeginninng:Number = url.indexOf("://") + 3;
          var pageDomain:String = url.substring(urlBeginninng);

          if (pageDomain!="www.prasaar.com/dev/trials/vss/index.swf") {
                    warning_txt.text=This file is running on the wrong pageDomain. Content Access Restricted!;
                    closeBoxTop.visible = true;
          } else {
                    warning_txt.text=Yes Player Visible;
                    closeBoxTop.visible = false;
          }
          stage.removeEventListener(Event.ENTER_FRAME, pageDomainCheckInit);
}

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 ,
Mar 24, 2012 Mar 24, 2012

Copy link to clipboard

Copied

not working this www.somedomain.com/test/index.swf

working this http://www.somedomain.com/test/index.swf ?

But should n't work in .html main page. i mean play normally.

or

How to get current url not swf path ( like www.somedomain.com/test/index.html).

---------------------------------------------------------------------------------------------------------------------

finally want i mean my swf file work in through html webpage.

if any one enter total swf path then file not download.


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
Contributor ,
Mar 25, 2012 Mar 25, 2012

Copy link to clipboard

Copied

LATEST

Hi,

there is no real way to find out the html page. You might use externalinterface to talk to the page from the movie.

Now, what actually do you want to achieve by not allowing visitors to view the swf without its surroundings?

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