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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-31-2015, 05:11 PM   #1
2MuchMark
Videochat Solutions
 
2MuchMark's Avatar
 
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!
__________________

Custom Coding | Videochat Solutions | Age Verification | IT Help & Support
www.2Much.net
2MuchMark is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-31-2015, 05:18 PM   #2
clickity click
So Fecking Bummed
 
Industry Role:
Join Date: Aug 2014
Posts: 3,682
Fuck Javascript.
clickity click is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-31-2015, 07:12 PM   #3
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
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 -->

?
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-31-2015, 07:13 PM   #4
marlboroack
So Fucking Banned
 
Industry Role:
Join Date: Jul 2010
Location: ☣
Posts: 9,327
and fuck you
marlboroack is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2015, 08:18 AM   #5
2MuchMark
Videochat Solutions
 
2MuchMark's Avatar
 
Industry Role:
Join Date: Aug 2004
Location: Canada
Posts: 49,007
Quote:
Originally Posted by freecartoonporn View Post
you want to detect users browser or just change
this
<!-- one two three four -->

to

<!-- two three four -->

?

Hiya,

I want to do this : If Browser = IE then

<!-- two three four -->

Else

<!-- one two three four -->
__________________

Custom Coding | Videochat Solutions | Age Verification | IT Help & Support
www.2Much.net
2MuchMark is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2015, 08:37 AM   #6
Paul&John
Confirmed User
 
Paul&John's Avatar
 
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");
__________________
Use coupon 'pauljohn' for a $1 discount at already super cheap NameSilo!
Anal Webcams | Kinky Trans Cams Live | Hotwife XXX Tube | Get your Proxies here
Paul&John is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2015, 07:39 PM   #7
Video-Post
Selling short ICQ numbers
 
Video-Post's Avatar
 
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>
Video-Post is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 01:06 AM   #8
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
what ^^ said will do it.
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 05:21 AM   #9
ravo
Confirmed User
 
ravo's Avatar
 
Industry Role:
Join Date: Jun 2001
Location: Skype: ravo.fpctraffic
Posts: 5,440
Quote:
Originally Posted by ********** View Post
... my programmers are off partying and getting laid, ...
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
ravo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 05:38 AM   #10
WorstDrug
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
WorstDrug is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 06:40 AM   #11
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Maybe this will help

https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 08:59 AM   #12
Barry-xlovecam
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 that could be useful to verify ...
Barry-xlovecam is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 03:44 PM   #13
Video-Post
Selling short ICQ numbers
 
Video-Post's Avatar
 
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
Quote:
Originally Posted by Video-Post View Post
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>
Sorry, small change - put the first code between the head tags instead of between the HEAD and BODY tags. It should work anyway but better stick to the norm.

Video-Post is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 03:51 PM   #14
Video-Post
Selling short ICQ numbers
 
Video-Post's Avatar
 
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>
...as anything in between the span tags will be changed according to the browser used when the page has loaded. You can also let it execute in real-time as the page renders in the browser.

Video-Post is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 04:08 PM   #15
Video-Post
Selling short ICQ numbers
 
Video-Post's Avatar
 
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>
Since it's just a quick check, this is probably the easiest and most sensible approach.

Video-Post is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-02-2015, 04:10 PM   #16
Video-Post
Selling short ICQ numbers
 
Video-Post's Avatar
 
Industry Role:
Join Date: Dec 2001
Location: NL
Posts: 1,118
Inside the BODY tags to be more precise.

Video-Post is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
page, appears, code, removed, comment, appreciated, tags, body, internet, web, user, detect, explorer, change, line, programmers, night, partying, friday, javascript, laid, stuck, website, staying, smarts



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.