![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Videochat Solutions
Industry Role:
Join Date: Aug 2004
Location: Canada
Posts: 49,007
|
Can someone help me with a Javascript problem?
So it's Friday night and my programmers are off partying and getting laid, and I'm staying in and trying to better my smarts with a little website work, and I'm stuck.
I have a line in my page that looks just like this, complete the comment tags. <!-- one two three four --> The above appears in the body of the page. What I want to do is detect if the user on the web page is using Internet Explorer, and if so, to change the code above so that it looks like this: <!-- two three four --> with the "one" removed. Any help is appreciated!
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
So Fecking Bummed
Industry Role:
Join Date: Aug 2014
Posts: 3,682
|
Fuck Javascript.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
|
you want to detect users browser or just change
this <!-- one two three four --> to <!-- two three four --> ?
__________________
SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
So Fucking Banned
Industry Role:
Join Date: Jul 2010
Location: ☣
Posts: 9,327
|
and fuck you
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Videochat Solutions
Industry Role:
Join Date: Aug 2004
Location: Canada
Posts: 49,007
|
Quote:
Hiya, I want to do this : If Browser = IE then <!-- two three four --> Else <!-- one two three four -->
__________________
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: YUROP
Posts: 8,606
|
Here is one type of code: javascript - jQuery: check if user is using IE - Stack Overflow
Code:
var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) alert("Its IE"); else alert("Its NOT IE");
__________________
![]() Anal Webcams | Kinky Trans Cams Live | Hotwife XXX Tube | Get your Proxies here |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Selling short ICQ numbers
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
|
Well, here you go - put this between the HEAD and BODY tags:
Code:
<script> function myFunction() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) document.getElementById("brchk").innerHTML = "<!-- two three four -->"; else document.getElementById("brchk").innerHTML = "<!-- one two three four -->"; } </script> Then insert this in the body tag to trigger the function above once: Code:
<body onload="myFunction()"> Finally, put this between the HTML tags in your document: Code:
<span id="brchk"><!-- lets check --><span> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
|
what ^^ said will do it.
__________________
SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Jun 2001
Location: Skype: ravo.fpctraffic
Posts: 5,440
|
LOL, rarely hear that about programmers....
__________________
AdultAdBroker - Buy and Sell Your Flat Rate Banners, Links, Tabs, Pops, Email Clicks and Members' Area Traffic - updated June 2025 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Registered User
Industry Role:
Join Date: Jun 2015
Location: San Francisco, California, USA
Posts: 11
|
You're better off handling this logic server-side, saving client-side resources (and making your website a tiny bit faster). I'm guessing that you use PHP since you're asking for technical help on, well, not the most technical forum on the web? :-p
__________________
Porn Video Compilations: The Worst Drug |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
|
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
It's 42
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 18,083
|
We capture the User-Agent: headers then output the correct URI for that browser -- I refer to it as the Internet Brick (IE). ** CSS notation is just if statements in the page source ** These headers are sent with the first server request by default. However, that sort of JavaScript would catch when forged headers are sent by a scraping browser
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | |
Selling short ICQ numbers
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Selling short ICQ numbers
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
|
Oh and I forgot the slash in the span tag. You can simply use:
Code:
<span id="brchk"></span> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Selling short ICQ numbers
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
|
If you want do it in real time, simply paste the code below somewhere inside the HTML tags:
Code:
<span id="brchk"><span> <script> var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) document.getElementById("brchk").innerHTML = "<!-- two three four -->"; else document.getElementById("brchk").innerHTML = "<!-- one two three four -->"; </script> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
Selling short ICQ numbers
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
|
Inside the BODY tags to be more precise.
|
![]() |
![]() ![]() ![]() ![]() ![]() |