Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-01-2008, 12:49 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default resolution detection with notification pop-up?

I have 15% of my visitors using 800x600 resolution, which makes my forum home look cramped and horrible. Can someone please explain how I can setup a script that automatically detects a visitor using this exact resolution (or perhaps any below 1024x768) and popup a window warning, or static warning on the actual page (maybe header?)...with a custom message suggesting they increase their resolution?

Even browser / version detection also would be great too, along with javascript being disabled.

I would appreciate some insight on this. Thanks.
Reply With Quote
  #2  
Old 07-01-2008, 01:18 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is a JavaScript that does exactly this
http://tech6.com/showthread.php?t=4

You can test a working Demo of this code at www.home.vinayaks.com , simply set your res. to anything less than 1024x768 and it redirects you to an error page.
Reply With Quote
  #3  
Old 07-01-2008, 01:23 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, but I do not want to block them out. I only want to post a simple small notice, a suggestion or "tip" of some sort.

If someone created a mod for this, that would be really neat.
Reply With Quote
  #4  
Old 07-01-2008, 01:30 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the above code does not block them out. If you go directly to http://www.home.vinayaks.com/home.php at res 800, you'd still be able to view the page.

So, you can simply provide a link at the error page to the main page (in my case home.php)
OR you can display a message at the main page itself with the help of the above code.
Reply With Quote
  #5  
Old 07-01-2008, 02:00 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added the below in headinclude template, my site refused to load.

Quote:
<script language="javascript">
if (window.screen){
var w = screen.width;
tmt_url_640 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_800 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_1024 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
if(w<740){
self.location.replace(tmt_url_640);
}
if(w>=740 & w<835){
self.location.replace(tmt_url_800);
}
if(w>=835){
self.location.replace(tmt_url_1024);
}
}
</script>
Any idea why?

headinclude looked like this with the script code

Code:
<meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" />
<meta name="generator" content="vBulletin $vboptions[templateversion]" />
<if condition="$show['threadinfo']">
<meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$threadinfo[prefix_plain_html] $threadinfo[title], $vboptions[keywords]" />
<meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[title] $foruminfo[title_clean]" />
<else /><if condition="$show['foruminfo']">
<meta name="keywords" content="$foruminfo[title_clean], $vboptions[keywords]" />
<meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$foruminfo[description_clean]" />
<else />
<meta name="keywords" content="$vboptions[keywords]" />
<meta name="description" content="$vboptions[description]" />
</if></if>

<!-- CSS Stylesheet -->
$style[css]
<if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')">
<style type="text/css" id="vbulletin_opera8fix_css">
ul, ol { padding-$stylevar[left]:20px; }
</style>
</if>
<if condition="$show['editor_css']">
$editor_css
</if>
<!-- / CSS Stylesheet -->

<style type="text/css">
@import url("clientscript/vbulletin_css/site.css");
</style>

<script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script>
<script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script>
<script type="text/javascript">
<!--
var SESSIONURL = "$session[sessionurl_js]";
var SECURITYTOKEN = "$bbuserinfo[securitytoken]";
var IMGDIR_MISC = "$stylevar[imgdir_misc]";
var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10);
// -->
</script>
<script type="text/javascript" src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script>
<if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if>

<script type="text/javascript">
document.cookie = "psistats_screenwidth = " + self.screen.width;
document.cookie = "psistats_screenheight = " + self.screen.height;
document.cookie = "psistats_screendepth = " + self.screen.colorDepth;
</script>

<script language="javascript">
if (window.screen){
var w = screen.width;
tmt_url_640 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_800 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_1024 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
if(w<740){
self.location.replace(tmt_url_640);
}
if(w>=740 & w<835){
self.location.replace(tmt_url_800);
}
if(w>=835){
self.location.replace(tmt_url_1024);
}
}
</script>

<if condition="$vboptions['externalrss']">
    <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] RSS Feed" href="external.php?type=RSS2" />
    <if condition="$show['foruminfo'] OR $show['threadinfo']">
        <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] - $foruminfo[title_clean] - RSS Feed" href="external.php?type=RSS2&amp;forumids=$foruminfo[forumid]" />
    </if>
</if>
Also, what's the actual proper way of linking/calling custom added pages (added via style manager)? For example, one of them is called custom_resolution_xp, but I linked the entire thing in the code. What would the short url be?

edit: with the way I linked to the custom page, the browser just looped when trying to load the page.
Reply With Quote
  #6  
Old 07-01-2008, 10:15 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
tmt_url_640 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_800 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_1024 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
How would you enter the site this way ?? You are blocking all the res. to enter the site.

Do something like this instead !!

Code:
tmt_url_640 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_800 = "http://www.talkjesus.com/misc.php?do=page&template=resolution_warning";
tmt_url_1024 = "http://www.talkjesus.com/";

Quote:
Also, what's the actual proper way of linking/calling custom added pages (added via style manager)?
You do not add custom pages through style manager. You add just templates. I'd also recommend you to put the res. code at the top of the headinclude template.

By the way, does this work ?
Code:
?do=page&template=resolution_warning
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:25 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03758 seconds
  • Memory Usage 2,219KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete