Should I use iframe or not?

Recommended Posts

I'd like to know what you guys think it's better: to embed the game code into the page or to use an iframe for that.


I read somewhere in the net that Google doesn't like iframes.


What you think? What are the advantages / disadvantages of each method?

Share this post

Link to post
Share on other sites

iframes are a good idea if you're distributing your game on website you don't own, similar to YouTube's embedded players, whereas YouTube don't use iframes when you're on their website itself.


The main problem you have with exposing the code to a page on it's own is that it's not encapsulated so the webpage might have something that conflicts with your code and break it.


With iframes everything is contained so you can rest easy there, as long as the page loads.


I think you're okay with Google since your game itself can't really be indexed anyway. 


Thinking towards the future this kind of problem might be solved with web components. You can check out web components right now by playing with the Polymer project:

Share this post

Link to post
Share on other sites

Google can't index Javascript applications very well, so as long as you surround the canvas.webGL context with relevant data your game will be fine.




If Google trawls your page and sees:


<h1>Super Awesome Game</h1>



It can't do anything with the canvas context but can index the header, so on a Google result you'll hit the page from the header not the canvas itself.


Hope that makes sense. 


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.