Welcome Guest, Not a member yet? Register   Sign In
detect JS with CI?
#21

[eluser]mr_coffee[/eluser]
Re: helper function
THAT... would likely work. I'll have to experiment! But thanks for putting the idea in my head. That's probably exactly what I need for this. Assuming the helper function doesn't get called automatically by CI with or without js enabled... as that's kind of the issue. But I'll have to try some things and see what happens.

Re: liquification.
Yes yes, I know... liquid layout, haha. If you saw the graphic layout, you'd understand! I had a designer create the graphics for me... and... well... I LIKE IT! I knew immediately that layout out the site in such a way would negate any sort of liquid layout. Normally, I'd say... give me something else. But since it's an artist/music site, this will work fine. I'll have to make certain amenities to do it this way. Yeah, it's "bad form" or whatever, but it looks awesome. If I have to rip out my hair finding some code to make js-disabled browsers play nice... it will be worth it. Besides just being worth it to find that answer even if I didn't use that answer on this site because I created a liquid layout.

Re: cell phones
Subset of javascript, sure. Enough of it though. Point is, can and WILL. And if it's one of those PDA things with either Internet Explorer or... crap I don't remember the other one. Not Safari but like a wanna-be Safari. Whatever, if someone is viewing a site via a 2 1/4" viewport, they get whatever they deserve. I was just making an observation, that's all. And I've no intention of making my web sites cell phone compatible. Maybe one day when everyone has a G3 capable - or whatever it's called - phone and people weren't being charged by the kilobyte for looking at websites if they don't have a PDA of some kind... Anyway, I'd not build such things into a real site... if my customers were interested I'd have them buy up the domain as a .cell or .phone or whatever that new one is and a cell browsing person would either know to check the extension or the phone would automatically try that before the .com anyway. And since I'd be constrained to text only since it would take 20 minutes to load the first page, it's unlikely I'd write any phone specific script to manipulate TEXT. I'm also not buying 7 phones with web service to test afterwards, haha. Do you think I'm evil for not caring what my sites look like on a Motorola Razor? Eh, maybe I am... but no matter how desperate I get for the internet I don't use mine to look up something on a site. No matter what happens, it's still a PHONE, which means I can call someone and ask.. and I've never created a site with such information that it would be necessary to make it phone compatible... and if I had to, and if it was text only... it would still be faster for the person to CALL SOMEONE, haha. Well maybe... I mean it takes me a good minute to "text" a web address but I suck at that keypad typing thing.
#22

[eluser]mr_coffee[/eluser]
NEWP. Attempts to load the function even with js disabled. Back to the drawing board...
#23

[eluser]mr_coffee[/eluser]
My temporary pseudo-ugly solution was to remove the 800x600 stylesheet completely, and set all the styles with javascript. I guess that's fine since the 800x600 wouldn't have been loaded without js, but I do feel it might be a slightly less efficient method for accomplishing the same thing. And I TRULY FEEL there should be a way of loading/running an independent php file outside of CI (inside a view) for the purpose of setting a variable, be it session or otherwise.
#24

[eluser]mr_coffee[/eluser]
Regardless...

here is this particular CodeIgnited MooTools site: http://newcreationmusic.us

I tried this in every browser less Konqueror as I don't have a nix build. I wasn't having issues... I tried multiple screen resolutions in each... with or without js enabled, the site was working fine for me. The friends who I built this site for has told me it "doesn't work"... but I can't seem to get them to elaborate. Is there an error? "Page cannot be displayed"? None of the links DO anything? You don't see the links? No idea. I've had a dozen people try this site and the only one not able to get on it - to my knowledge - is a member from the group in question. As of now... really hurting my chances of being able to do either of the other two sites she needs. If you're reading this, please let me know if you're able to access the site. As a bonus, any opinions you might have on the outcome would also be nice, but I'd really just like to know if it works for you. Turn your speakers down as there's a few second musical intro I don't want giving you a heart attack.
#25

[eluser]xwero[/eluser]
I noticed on the discography page the contact button is over the content but apart from that everything looks fine.

Did you ask the member which browser he is using than you can focus your debugging on that browser.
#26

[eluser]mr_coffee[/eluser]
Haha, so it is. I didn't even notice! I may shrink the size of the container a bit so that doesn't happen, but it doesn't appear to affect functionality.

I ASKED... but she didn't say. That was over a week ago when I was still testing shizzle. My most recent message to her was "I'm done! Try again!" to which she repeated... this very morning... "it doesn't work!" With no elaboration. So I asked... AGAIN but am doomed to sit and wait for either a reply or someone else to have the same issue so they can help me debug, or at least elude to the issue so that I have something I can test in and try to recreate the problem. I don't think it's really a site issue... might be an ISP or DNS thing but I'd need more than one person to say so.. at least then I'd have a regional thing I could narrow it to.

Thanks for pointing out the overlap... I thought i'd compensated for that. I'll fix that tonight. Minor stylesheet tweak, really.
#27

[eluser]xwero[/eluser]
Nice :-S for all you know she is using netscape 3.You pull your hair out with customers like that. I usually point out how important information is and that they as clients are a part of the development team too. If they still refuse to share information than i let it go knowing i did the best with the information i recieved.
#28

[eluser]mr_coffee[/eluser]
Point. I don't think she's that far behind the times though as she can view her photography site just fine and it's all flash and buggy html taken out of a template. So... dunno. Personally I think it's her ISP blocking the extension .us or Microsoft's auto-fill-in tossing .com on the end, but I can't prove anything... yet. All I know is so far no one else has said "it doesn't work".. so it works.

Besides, I originally made it as a fan site in high school. I won't be getting paid for the redo either, I was just hoping to impress her enough to hire me and my friend up for their next two sites which we actually would take payment for. That will be a bit of a trick though if she can't even load the page.

I HOPE she doesn't have netscape 3 because I just tried to install it - ya know... just to see - and found that I cannot, haha.
#29

[eluser]mr_coffee[/eluser]
For those interested... here's another method to detect Javascript using CI and MooTools:

in the controller: enable sessions. I tried just passing a variable using "$this->load->vars($array)" ... but to no avail. While this is accessible from every view loaded - as advertised - it can't be changed by those views. A cookie can. However - using cookies is a faltering approach... though by the completion of this page view - the cookie will have been set - it will not have been set before the page has already been viewed (I'll elaborate later). Therefore: this still isn't perfect as until the user browses away from the first page, it hasn't been fully established that they can use JavaScript.

For my implementation - the Input class needs the following addition:
Code:
function isAjax() {
    return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']=="XMLHttpRequest");
    }
Just stick it in the bottom before the last '}'. This is how I determine if the page requested was requested through Ajax. By the way - if the page has been requested through Ajax: your user can view Javascript.

In the controller's constructor:
Code:
$this->load->library('session');
if ($this->input->isAjax()){
  $this->session->set_userdata('jsenabled','true');
}

Now... I put that in my default controller. I suppose you can use that part wherever you'd like. Also in my default controller, I accommodated for the possibility that there'd be a request made for a checkjs page. You can call it whatever you want... there doesn't have to be content for this view (since the controller already realized it was Ajax and already set the cookie) ... though you might have been able to set the cookie through the function for your checkjs page and not have modified the Input library... but that modification is so useful, my assumption is you've done as much.

Call your view whatever.php and upload it. Again, doesn't need content, but there has to be a reply.

I figure the best spot to put this code is right after the <body> tag of the page and before your actual header markup... just to get it out of the way. If you've got Mootools installed, this will work:
Code:
<?php
    if (!($this->session->userdata('jsenabled'))) {
        echo '<div id="jscheck" style="display:none"></div>';
        echo '[removed]$(\'jscheck\').load(\'../checkjs.htm\');[removed]';
    }
?&gt;
This belongs in a page view. Doesn't matter which one... so I just made it part of my header information - it's in all of them.

Yeah, I've got it set to have .htm extensions on my files. If you don't have MooTools going, then replace the javascript with whatever code will work for what you've written. There's no point in running this again if the cookie has been set, and that's why the if statement.

AFTER the load of the view - the cookie is accessible. It is NOT accessible DURING the load of the view - except by the "embedded" Ajax view itself. For instance, in checkjs, I could echo the value of the userdata variable.... but later down this view (the one that has the Ajax call in it) I could echo the value and it would be false. However, since the session variable sticks around, it's only an issue on the first page. The only work-around I think of is to load the REST of the page view using Ajax if it was somehow time-critical to know the user could handle JavaScript for the rest... unfortunately - if they can't - they won't be able to see the rest of the page, so that's not a solution.

I've tried a few variations. It's not enough to have the page content in another view. That code is in a view called 'header' and the page content is in a view called 'home' ... 'home' won't know the value of that cookie either. It may be an "asynchronous" load... but the first request for the page was not. The cookie won't be available until another page load happens. If there's some way to set or retrieve a variable without that limitation - and I doubt there is - but if there was, this is how you could implement it: replacing the session variable with whatever is more useful.

Hope that helps someone.




Theme © iAndrew 2016 - Forum software by © MyBB