Author Topic: html execution in javascript?  (Read 9025 times)

0 Members and 2 Guests are viewing this topic.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: html execution in javascript?
« Reply #15 on: August 05, 2011, 09:19:49 am »
Try changing that to detection.php ;)
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: html execution in javascript?
« Reply #16 on: August 05, 2011, 11:44:29 am »
well I can't change it to .php where the final version of this code will be used at. Is there a way I can do google chrome detection the same way I did in css? that's probably my only hope now
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: html execution in javascript?
« Reply #17 on: August 05, 2011, 11:56:58 am »
Sorry, didn't exactly read the last post :P Try this...
Code: [Select]
<div id="chrome">You have chrome!</div>
<div id="nochrome">You don't have chrome =\</div>
<script type="text/javascript">
    if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
        document.removeChild(document.getElementById("nochrome"));
    } else {
        document.removeChild(document.getElementById("chrome"));
    }
</script>
« Last Edit: August 05, 2011, 11:59:23 am by cooliojazz »
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: html execution in javascript?
« Reply #18 on: August 05, 2011, 12:28:49 pm »
it outputs this in chrome and firefox:

You have chrome!
You don't have chrome =\

:(
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: html execution in javascript?
« Reply #19 on: August 05, 2011, 01:31:56 pm »
Guys, don't you only need to use the CDATA tag when the page is in XHTML?
Yeah, that. The only point of it is to protect the well-structured XML.




Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: html execution in javascript?
« Reply #20 on: August 05, 2011, 01:41:14 pm »
You should be using XHTML anyway ;D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: html execution in javascript?
« Reply #21 on: August 05, 2011, 01:47:50 pm »
well not all of us know xhtml.. lol. I only know html and how to construct html 5
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: html execution in javascript?
« Reply #22 on: August 05, 2011, 01:48:54 pm »
XHTML is just HTML that actually obeys XML standards. That's all.
So, instead of <br>, use <br/> (or <br /> to make some HTML parsers happy).
« Last Edit: August 05, 2011, 01:50:07 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: html execution in javascript?
« Reply #23 on: August 05, 2011, 01:49:51 pm »
it outputs this in chrome and firefox:

You have chrome!
You don't have chrome =\

:(
Here's some browser information to help you refine your check :)
« Last Edit: August 05, 2011, 01:51:31 pm by BlakPilar »

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: html execution in javascript?
« Reply #24 on: August 05, 2011, 01:52:48 pm »
so then in that case, the code has to be specific enough to identify chrome from firefox.. Hmm. This im not sure how to do. Man i might be trying to do the impossible really :S
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: html execution in javascript?
« Reply #25 on: August 05, 2011, 03:23:41 pm »
The only thing you need to pay attention to is the user agent header. Chrome is the only one that has the word "Chrome" in it.




Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: html execution in javascript?
« Reply #26 on: August 05, 2011, 03:43:15 pm »
See, that's what i get for just writing code without actually trying it =P Try this:
Code: [Select]
<div id="chrome">You have chrome!</div>
<div id="nochrome">You don't have chrome =\</div>
<script type="text/javascript">
    if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
        document.body.removeChild(document.getElementById("nochrome"));
    } else {
        document.body.removeChild(document.getElementById("chrome"));
    }
</script>
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: html execution in javascript?
« Reply #27 on: August 05, 2011, 05:20:54 pm »
OOOOO
MMMMMM
GGGGGGGGG

THANK YOU SOO MUCH!!! IT WORKS :D
« Last Edit: August 05, 2011, 05:27:10 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: html execution in javascript?
« Reply #28 on: August 05, 2011, 09:25:57 pm »
np :) Glad it worked for what you needed :)
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)