[PLUGIN] iframe filter

1 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Braus

    You only need provide part of url string if using "system expression:find".

    If someone embeds your application into an iframe, the expression:MainFrameURL will return different value, unless he embeds your main frame into his iframe ->

    His main frame - iframe ( your main frame ) - iframe ( your application ).

    I guess that the expression:MainFrameURL will still return your main frame's URL.

  • Braus

    You only need provide part of url string if using "system expression:find".

    Sorry, but I don't know how the "find" expression works. I didn't find any example about it in the manual.

    Could you provide a simple example here (it's not necessary a capx)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • rexrainbow: Thanks for the example. Unfortunately I cannot send you a PM for while.

    In your example you didn't use the iframe filter. Why?

    In this same example, what's specifically is SRC and what is TARGET?

  • Braus

    The example only focus on "how to use system expression: find", that why I do not use iframe.

    SRC is the MainFrameURL , TARGET is the url you allow.

  • Braus

    The example only focus on "how to use system expression: find", that why I do not use iframe.

    SRC is the MainFrameURL , TARGET is the url you allow.

    But how can I check the TARGET if I've only the MainFrameURL expression in the iframe filter plugin? (Sorry, I'm not so clever )

  • Braus

    For example, your URL of main frame is https:\\www.yourwebsite.com\xxxx...

    Then you might try

    find( MainFrameURL, "www.yourwebsite.com")

    If MainFrameURL does not contain "www.yourwebsite.com", the find expression will return -1.

  • Ok. And how can I use it with the iframe filter?

    start of layout

    iframefilter inframe

    iframe filter.MainFrameURL = "https:\\www.yourwebsite.com\xxxx..."

    find(MainFrameURL, "www.yourwebsite.com") : go to layout 1

    else : go to layout 2

  • Braus

    Sorry, I tested the main frame after exported, only in preview situation will get a correct MainFrameURL, otherwise I get "".

    The solution might be failed, this iframe filter only could check if current frame is in iframe or not.

    I will try to find another way to solve this issue.

    The checking of iframe still works, and the redirection of main frame works well, too. But expression:MainFrameURL failed.

  • Ok. Thanks anyway.

  • rexrainbow: What do you think about this solution?

    • iframe filter to check if the game is within a iframe + browser.pathname to restrict the game opens only if the relative path is what I have determined instead to control the url

    If someone want to insert my game within a iframe, he will need to use the whole address instead the path only, right?

  • Braus

    You could try, but I guess it will be failed.

    Because the application in iframe does not know the url of main frame, and the url of application is not hard to pick, imo.

    Here is another plugin which can send message between main frame and iframe, or between iframes. I will use this plugin to check if the main frame is my page. I will do it in the weekend.

  • Braus

    I had made a solution to to recognize the main frame.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)