Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by josecm · May 30, 2011 at 04:35 PM · checkiframe

How to check iframing into a iframe?

Hello i want to protect my Kongregate games but, there is a problem. Kongregate iframe the games, and seems to be Kong's iframe is hosted on "a.kongregate.com".

But somebody thieves the kongregate games and iframe the iframed Kongregate games.

How i can check up the parent tree to see how many levels of iframe the game is in?

And, if it is one level of iframe how check where the parent window is?

i am very noob with this, and i don´t know how to get it.

Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by BerggreenDK · May 30, 2011 at 08:39 PM

The frames in a browser are put in the DOM hierachy.

I havent tested if you can do this from within Unity player itself, but you can access DOM through Javascript on clients, so if you somehow call javascript from within Unity player, it should work.

The DOM will have the browser window as the "top/parent".

Below this are your "documents/children".

So if you are in browserwindows//iframe(thief)/iframe(kongregate) Then you should be able to detect if TOP == KONGREGATE or not.

This sample will check if you are inside a frame or not, but at KONGREGATE you are.

 if (window!=window.top) { /* I'm in a frame! */ }

This is javascript code, so you will have to figure out how to make this check from within Unity player.

Secondly, parent to your Unity game would be Kongregate, so it might be something like:

 if (parent!=window.top) { /* if my parent isnt top */ }



Let me know how it works, okay? I can do Javascript too, but havent got the time right now.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by josecm · Jun 01, 2011 at 06:30 PM

 function Start (){
 Application.ExternalEval("if(document.location.host != 'a.kongregate.com') { document.location='http://www.3dart.es'; }"); 
 
 Application.ExternalEval("if (parent!=window.top)  { document.location='http://www.3dart.es';}");
 }


I knew the first code, but with the second i can block the Iframe thieve (the first code is when somebody upload directly the ".unity" file to their Web page).

i uploaded the game in ".unity" format and "Iframed version" to my Web page and seems to block both correctly!! (the game stops and go to my web page´s index "www.3dart.es").

thanks a lot!!!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image josecm · Jun 01, 2011 at 08:40 PM 0
Share

i iframed the game in my Web page with this code:

 <iframe src="http://www.kongregate.com/games/josecm/physics-fruits_preview" width=800 height=450>Texto para cuando el navegador no conoce la etiqueta iframe</iframe> 

it is the correct way? thanks.

avatar image BerggreenDK · Jun 03, 2011 at 11:24 AM 0
Share

For anything that has attributes within HT$$anonymous$$L tags, always encapsulate with " " around the values.

width="800" height="450" etc.

This is going to be standard in future, I think - as it already is part of strict HT$$anonymous$$L and HT$$anonymous$$L5 specs.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Bootcamp damage 0 Answers

How can I check if an animation has finished playing? 1 Answer

Check if GUI.Window is open 0 Answers

Check if there is a child with a tag? (multiple children but each diff tag) 1 Answer

Is it possible to check which point is being touched? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges