Author Topic: iFrame question  (Read 1863 times)

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
iFrame question
« on: February 01, 2010, 05:19:10 AM »
Basically, i'm wondering if the following is possible.  I'm currently building a page to help me with development by letting me input data into the proper parts and thus add weapons, armor, quests etc. What i'm wanting to do is to somehow... I want it to be able for me to by using iFrames to reload said iFrame itself and show different layout based upon what i said to use for it. Like for example, there'll be a little series of buttons that'll let me click them then it'll let me go to the quest adder etc. etc. or i can pull up a quest. What i was wondering is if, i could do all of this from teh same php file. Would that be possible with teh iFrame? Or will i have to use various php files. I'm asking since i've never used iFrames before and have just heard about them and just now and realizing how powerful they could be.

Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: iFrame question
« Reply #1 on: February 01, 2010, 06:30:40 AM »
Sounds basically like you want a full admin panel, I was planning on doing the same putting editing/adding of items all on one page, but i found it much easier to do it individually. I've got a main admin panel with links to each of the editors ie.. edit/add quest, edit/add armor etc This way its 2 clicks, and you can add or edit whatever you like. And as for separate files it doesn't  really matter in this case, because you simply just change a few lines of code and you can just copy and paste to each of the individual files, because all you'd need to change it was table there editing/adding to.
People Like You, Are the Reason People Like Me Need Medication

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: iFrame question
« Reply #2 on: February 01, 2010, 10:24:39 AM »
An iframe is, put into simpler terms, an embedded view of another URL. So, anything you can do with a single web page, you can do with an iframe by altering the URL that you're viewing.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #3 on: February 02, 2010, 12:03:59 AM »
hmm... now i need to just get this basic idea of the iframe's placement on the actual page itself. Time to whip out some gimp and start doing mockups i guess.

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: iFrame question
« Reply #4 on: February 02, 2010, 08:17:34 AM »
Also, heres a link to WCAG 1.0 Guidelines for Frames and also the WCAG 2.0 Guidelines for Frames. In case anyone cares about making frames more accessible for users with disabilities or for users with browsers that do not support frames (maybe some spiders or something I dunno, I just believe in covering my bases).
Idiocy - Never underestimate the power of stupid people in large groups.


Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: iFrame question
« Reply #5 on: February 02, 2010, 03:14:01 PM »
Correct me if I am wrong, because i was planning on doing iframes in my UI until i had done some reading on them, and for SEO its also a problem because most  search engines cannot read them, which is why i switched to <div> instead
People Like You, Are the Reason People Like Me Need Medication

Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: iFrame question
« Reply #6 on: February 02, 2010, 03:32:18 PM »
Correct me if I am wrong, because i was planning on doing iframes in my UI until i had done some reading on them, and for SEO its also a problem because most  search engines cannot read them, which is why i switched to <div> instead

Yeah, it's bad for SEO :). If you are using it like an admin panel or something ( I'm not sure what is your goal exactly ) then SEO shouldn't be an issue. I never worked with iframes and would ajax instead but that's a personal preference. Ajax is as bad as iframes for SEO, btw.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #7 on: February 02, 2010, 10:19:56 PM »
yes but then divs wouldn't allow for the entire web page to exist in part of the page then would they? And currently i'm using it as part of the developer page. So honestly no Search engine should remotely be near that page. Also inside of the game world i believe i'm still going to use them so that i can do things with it w/o having to completely reload entire pages.

Mainly such as, little "psuedo popups" like what you'd normally get in a game that kinda goes over the background of it all. It'll display some info w/o having to take out the entire back page.  And web based mmos shouldn't really imho have more than their few front pages for everyone to see. So using iframes inside of the game itself doesn't seem bad to me at all.

Offline raestlyn

  • Level 29
  • **
  • Posts: 464
  • Reputation: +9/-5
    • View Profile
Re: iFrame question
« Reply #8 on: February 03, 2010, 01:41:33 AM »
yes but then divs wouldn't allow for the entire web page to exist in part of the page then would they?
Actually, you can do that. You just need a simple ajax call, nothing more.
Quote
And currently i'm using it as part of the developer page. So honestly no Search engine should remotely be near that page. Also inside of the game world i believe i'm still going to use them so that i can do things with it w/o having to completely reload entire pages.

Mainly such as, little "psuedo popups" like what you'd normally get in a game that kinda goes over the background of it all. It'll display some info w/o having to take out the entire back page.  And web based mmos shouldn't really imho have more than their few front pages for everyone to see. So using iframes inside of the game itself doesn't seem bad to me at all.
Why?
Unless you are using Comet with Iframe updating I would suggest that you wouldn't use them. You can do everything you could do with them with ajax. And it would be faster, as the whole pages (css and javascripts) would be loaded to the screen while making ajax call would limit it to the html (or xml or json).


I can send you pics of my cocks if you want reference.


Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: iFrame question
« Reply #9 on: February 03, 2010, 10:43:27 AM »
There's also very good documentation and browser support for ajax. Check out the jQuery library. I set up my ajax data transmission for my game yesterday and it is soooo easy ^^. You could, for example, only load json to display data in a set layout or you could even load a whole bit of html (if you have some sort of templating system) and replace a whole part of the page with anything :P.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #10 on: February 04, 2010, 04:30:08 AM »
yes but then divs wouldn't allow for the entire web page to exist in part of the page then would they?
Actually, you can do that. You just need a simple ajax call, nothing more.
Quote
And currently i'm using it as part of the developer page. So honestly no Search engine should remotely be near that page. Also inside of the game world i believe i'm still going to use them so that i can do things with it w/o having to completely reload entire pages.

Mainly such as, little "psuedo popups" like what you'd normally get in a game that kinda goes over the background of it all. It'll display some info w/o having to take out the entire back page.  And web based mmos shouldn't really imho have more than their few front pages for everyone to see. So using iframes inside of the game itself doesn't seem bad to me at all.
Why?
Unless you are using Comet with Iframe updating I would suggest that you wouldn't use them. You can do everything you could do with them with ajax. And it would be faster, as the whole pages (css and javascripts) would be loaded to the screen while making ajax call would limit it to the html (or xml or json).
er... i guess i'll look into some ajax then... i was just trying to use things i knew about is all :/

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: iFrame question
« Reply #11 on: February 04, 2010, 08:28:59 AM »
The only "gotcha" I have with AJAX is that it doesn't work if the user has JavaScript disabled (because it is just a JavaScript library). So, it's especially great in controlled environments (admin panels where the number of visitors is limited or similar) however, if the component is meant to be accessed by site visitors, make sure it at least is capable of graceful degradation.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline mobeamer

  • Level 13
  • *
  • Posts: 93
  • Reputation: +0/-0
    • View Profile
    • Untouchable Games
Re: iFrame question
« Reply #12 on: February 04, 2010, 02:14:34 PM »
AJAX is definitely the way to go.

iFrames have another little known issue, its difficult to pass information from the child frame to the parent window. So if an action inside the iFrame causes your main window to need a change, your going to have problems. (I know this can be solved, but its a cludge to get it working)

Here's a bit of AJAX to get you started....

It's not production ready, but it'll give you a place to start...there are a ton of libraries that do better then this:

//
//DONT JUST CUT AND PASTE...READ AND UNDERSTAND...IT WONT WORK IF YOU JUST PASTE THIS CODE IN.
//
var xmlHttpDivID = "";
var xmlHttp = "";
var xmlInUse = "N";

function GetXmlHttpObject(handler)
{
    var objXMLHttp=null;
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }

    if(objXMLHttp == null)
    {
       alert("Your browser is not AJAX/Web 2.0 enabled");
    }

    return objXMLHttp;
}

function refreshChat()
{
   //alert("Refreshing Chat");
   chatXmlHttp=GetXmlHttpObject();

   url = 'widgets/displayChat.php';
   chatXmlHttp.onreadystatechange=refreshChat_Complete;
   chatXmlHttp.open("GET",url,true)
   chatXmlHttp.send(null);

}


function refreshChat_Complete()
{
   if (chatXmlHttp.readyState==4)
   {
      fullText  = chatXmlHttp.responseText;
      document.getElementById("chatDiv").innerHTML = fullText;
   }
}


I build games
My Blog

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #13 on: February 04, 2010, 11:45:47 PM »
The only "gotcha" I have with AJAX is that it doesn't work if the user has JavaScript disabled (because it is just a JavaScript library). So, it's especially great in controlled environments (admin panels where the number of visitors is limited or similar) however, if the component is meant to be accessed by site visitors, make sure it at least is capable of graceful degradation.
the only real things i can see javascript being used for is well teh chat system, the admin/developer panels and maybe the loading of random pages within the page thing. Since this fellow above me is insenting that i try it which i will but i'm not going to guarantee that i'll stick with it. I'm going to try to make the site atleast work w/o javascript. It won't have the auto-refreshing chat, or some of the other more fancy features but they'll still be able to use it nonetheless. I'm also planning on having two site designs, one for those who have a faster internet connection and one for those with a slower one/maybe a mobile phone or something similar. The first will be entirely w/o any graphics except maybe a mob when you go into battle. The latter will feature all teh graphics and thus require atleast a 512k line(i beleive i'll try to optimize the code as much as possible) to run w/o a hitch.  So by doing it this way, i can let those with dialup still use the site w/o any real worries about the speed. Also the dialup friendly version of the site will attempt to use as little "ooh shiney" as possible but still make sure that it has all the core elements still inside of the game. Since i don't want to discriminate against those who would rather get the maximum performance rather than the "ooh shiney" effect of teh game.

edit: i went to his site and if you don't have javascript enabled you can't really do anything... the only thing that actually works is the link where you can view a random battle. The TOS don't load(VERY IMPORTANT IMO), so knowing that that's how he has done his site... i find it very worrysome since he's assuming that everyone out there just goes around with javascript enabled 24/7.  Personally, if i was doing your site, i'd make the TOS atleast show up to the person when they clicked it even w/o javascript.
« Last Edit: February 04, 2010, 11:55:17 PM by 133794m3r »

Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: iFrame question
« Reply #14 on: February 05, 2010, 12:11:26 AM »
Sounds to me maybe like your partnering with the wrong person, unless he intends to catch you up to speed on what it is he's doing,how it works etc
People Like You, Are the Reason People Like Me Need Medication

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #15 on: February 05, 2010, 12:16:14 AM »
Sounds to me maybe like your partnering with the wrong person, unless he intends to catch you up to speed on what it is he's doing,how it works etc
i'm not partenering with anyone... the guy's insisting upon trying ajax instead of iframe. So i'm going to attempt to see how ajax works in such situations. I am in no way related to the poster who posted an example ajax chat code snippet.

edit:And he said to try ajax to do such things, so it seems like i may try it. Since this entire thing as i have said in other posts, is a learning experience for me to see about somethign that i've always liked to fiddle around with. And i'm always up for mastering new languages/technologies.
« Last Edit: February 05, 2010, 12:17:46 AM by 133794m3r »

Offline raestlyn

  • Level 29
  • **
  • Posts: 464
  • Reputation: +9/-5
    • View Profile
Re: iFrame question
« Reply #16 on: February 05, 2010, 01:34:19 AM »
Really, now.
 Ajaxed UI is for more than just chat. It will give you more flexible and dynamic layout and opens up possibilities for things as MoveableMap (search the forums), Json based MVC structure and much much more. Making "ordinary" layout is most of the times just a waste of bandwith, for example when in your game a player heals x hit points why you would load the whole page when all you need is to update a line or 2? Not to mention that the players won't need that fast connection then, as they need to load the page just once.

People without js are less than 3% of all users, are you going to see all the trouble just for them?


I can send you pics of my cocks if you want reference.


Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: iFrame question
« Reply #17 on: February 05, 2010, 01:42:50 AM »
My Apologies Must have read it wrong,but being in the same boat as you are unsure of exactly what to use and where ( i just switched to a js based menu for example) No matter what you do there will always be a small percentage of users with X setup that your game setup regardless of how you set it up will not work for. Just for example, you have those with js disabled, those who play from work machines still running IE6 etc  The list could go on. The idea is to be able to cater to the mass majority of users with ease,and for those small % of users who are unable to play the game for whatever reason you can always have a suggestion list of things for them ie a browser on a pendrive for example, or how to enable js etc,thus allowing the majority of users to play with ease and giving those who fall under X there options if they truley wish to play.
People Like You, Are the Reason People Like Me Need Medication

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #18 on: February 05, 2010, 01:49:29 AM »
Really, now.
 Ajaxed UI is for more than just chat. It will give you more flexible and dynamic layout and opens up possibilities for things as MoveableMap (search the forums), Json based MVC structure and much much more. Making "ordinary" layout is most of the times just a waste of bandwith, for example when in your game a player heals x hit points why you would load the whole page when all you need is to update a line or 2? Not to mention that the players won't need that fast connection then, as they need to load the page just once.

People without js are less than 3% of all users, are you going to see all the trouble just for them?

that's one of the reasons i was going to use iframes :P so that i could not have to reload entire pages. I was going to have a small little thing showing their HP/mp, exp and if they had a pet its stats too. Etc. etc.
« Last Edit: February 05, 2010, 01:51:11 AM by 133794m3r »

Offline dsheroh

  • Level 21
  • *
  • Posts: 235
  • Reputation: +6/-0
  • Perl Vicar
    • View Profile
    • Psi Rangers
Re: iFrame question
« Reply #19 on: February 05, 2010, 04:25:28 AM »
I'm going to try to make the site atleast work w/o javascript. It won't have the auto-refreshing chat, or some of the other more fancy features but they'll still be able to use it nonetheless.

Good!  That's definitely the Right Way to do it.  If you want to find more information on the general technique, it's usually called either "progressive enhancement" or "graceful degradation", depending on whether you view it as a basic interface that gets better when more bells and whistles are available or as a whiz-bang interface that remains usable despite missing features.

Making "ordinary" layout is most of the times just a waste of bandwith, for example when in your game a player heals x hit points why you would load the whole page when all you need is to update a line or 2?

"No AJAX" does not imply "timed full-page reloads"; many designs do not require real-time autorefreshing displays at all.  Although there are exceptions, most would still work just fine if your HP display stays the same on screen until you click something to initiate a new action.

People without js are less than 3% of all users, are you going to see all the trouble just for them?

I don't know how you go about things, but, the way I work, providing both static and AJAX-enhanced versions of the pages I output is no extra trouble at all.  Just build the full output pages up from a collection of independent sections, then send replacement versions of specific sections in response to AJAX requests, and you've got a site that uses AJAX when available while remaining completely functional without it, all at a cost of zero additional programming time over what an AJAX-only version would take.

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: iFrame question
« Reply #20 on: February 05, 2010, 08:58:18 AM »
People without js are less than 3% of all users, are you going to see all the trouble just for them?
Audience is everything and it's apparent that you've probably never encountered a savvy web user with a mind towards security. My father is one of those people that has JavaScript disabled. Not because he has a browser incapable of it (there are very few who meet that criteria that aren't search robots! lol) but because he works as a security administrator. He is all to aware of all the issues that can be exploited by a malicious JS coder and chooses to disable it by default. He may turn it on for certain sites that he trusts, but your site should still remain functional without the JavaScript component.

And, sure, it's 3% of the population but if you can include that 3% then you've just eliminated a limit on your potential market (not to mention display that you're a developer who can make an accessible website which has the side-effect of making you a desirable hire for potential clients).
Idiocy - Never underestimate the power of stupid people in large groups.


Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: iFrame question
« Reply #21 on: February 06, 2010, 05:26:13 AM »
JGadrow, does your father play browser based games?

133794m3r, where do you want your focus to be? Website accessibility or game creation? There is no one wrong among the posters in this topic but you need to see it in your context.

Dsheroh says it's not much of a hassle to do it for both js users and those who have js disabled. That's me be true for en experienced programmer but I can insure you it won't be that easy for you. It's absolutely possible, but when will you be able to do some actual game design? If you are new to PBBG development and programming you can get burned out pretty quickly.

So if you want to stress on improving your programming skills, go the hard way. If you want to improve your game creation skills, go the easier way.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: iFrame question
« Reply #22 on: February 06, 2010, 05:39:03 AM »
JGadrow, does your father play browser based games?

133794m3r, where do you want your focus to be? Website accessibility or game creation? There is no one wrong among the posters in this topic but you need to see it in your context.

Dsheroh says it's not much of a hassle to do it for both js users and those who have js disabled. That's me be true for en experienced programmer but I can insure you it won't be that easy for you. It's absolutely possible, but when will you be able to do some actual game design? If you are new to PBBG development and programming you can get burned out pretty quickly.

So if you want to stress on improving your programming skills, go the hard way. If you want to improve your game creation skills, go the easier way.

i've programmed alot in the past and i've made some simple games and haven't done any PBBGs before. And i was simply doing it b/c as they say "Rome wasn't built in a day" so i don't see why i should attempt to make my entire site full of dynamic ajax templates and all of these random javascript items right out of the door. I also don't know of any companies who when making their game engine/framework sit down and make it render in OpenGL, Directx10,10.1, 11 and also have parallel rendering, and all other types of particle effects and the physics engine hand coded from scratch. I was attempting to have it be two ways simply b/c i was goign to of course have a svn type item set up. So the ones w/o all the fancy ajax templates and such(when i get there) will be the pages that i'll be using that just work. I prefer to start off with a nice working base then advance it more and more rather than attempting to do everything out of the door without that much prior knowledge before hand.

The best analogy that i can think of is if someone's new to C++ and mmo development, and you sit them down and tell them. Ok now you need to have this this and this feature, you need to have your own physics engine, it has to render using open gl, and directx, it has to be able to support 5,000 vs 5,000 pvp at all times. And it has to be able to render at 30fps on hardware that's 5 years old. Start now and also we wnat you to immediately build each part without really getting a nice base in the language go and make it all right away.

that's why i said i was going to do two versions of it atleast in the beginning part of the game's development. I'm going to have a simple page that just works and i know it works. Then i'll be looking into all of the fancy tricks that ajax can do with the page. And i'll be editing those things and release them when i have enough to do so on the actual game's site. But i will still be doing some game design work and adding things to the database since the database isn't likely to have to change all too much based upon the layout of the page.

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: iFrame question
« Reply #23 on: February 08, 2010, 08:50:39 AM »
JGadrow, does your father play browser based games?
Actually... yes. :) Not very many and he tends to prefer quick, non-persistent games like puzzles or similar games that he can just play for 30 min or so and then move on to something else. But, as I said, he does make exceptions on a case-by-case basis.

I try and keep an eye out for accessibility issues. You'd be surprised how many people out there don't have perfect vision, or have a hearing impairment, or lack fine-motor skills. My father's best friend is color-blind, one of my ex-wife's friends was "legally blind" and used a screen reader to browse the web, My ex-father-in law was nearly deaf. These are people that I knew and that I could think of without really digging into my memory very much. It's just made me a better coder keeping in mind that not everyone is equal in terms of access to a site.

That's not to say that if you don't do it that you're a bad person, it just means you don't hold your code to the same standards that I hold mine which is perfectly normal. However, it can't hurt you to allow the possibility of disabled gamers to visit your site. If you allow yourself to start coding accessible content, it will start coming naturally to you and will require no invested time and a great experience will be had by all. :)
Idiocy - Never underestimate the power of stupid people in large groups.


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal