web page title lenght

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
aubree
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Sun Sep 28, 2014 7:03 am

web page title lenght

Post by aubree » Sun Sep 28, 2014 7:26 am

Hello!

Has the lucky owner of CSE HTML Validator pro, v 14.05, I would like to know if it is possible to modify the title length threshold in the Batch Wizard (presently 70 characters) in order to check the pages with a title length above a certain limit.

Many thanks for your help.

Kind regards.

GA

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3412
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: web page title lenght

Post by Albert Wiersch » Mon Sep 29, 2014 9:15 am

Hello,

Sure, you can do this. Please note however that the below method causes it to change for all validations, not just in the Batch Wizard.

Code: Select all

// cancel the message with an ID of 2013103103
function onMessageID_2013103103() {
 $omid_cancel=true;
}

function onEndTag_title() {
 if getValueInt(41)>100 { // check the number of characters of the text content of the tag that is being ended
  MessageEx(5,2014092900,MSG_WARNING,$SEARCHENGINE,"This document's title is "+getValueInt(41)+' characters and may be too long.',getLocation(3));
 }
}
Copy the above code into a text file, like MyCSEUserFunctions.cfg and then open the Validator Engine Options in CSE HTML Validator and go to the 'Validator Engine->Config File' options page and specify the text file (MyCSEUserFunctions.cfg) as one of the 'User functions' file. Be sure to reload the configuration for the change to take effect (it should ask if you want to do this when you click 'OK').

It works by disabling the default (original) message that has an ID of 2013103103 and then doing its own check and generating its own message. The above checks if it is greater than 100 characters but you can easily change the above function to what you want, just make sure to restart CSE HTML Validator or at least reload the configuration in order for any changes to take effect.

I hope this helps. Please let me know how it works for you.
Image
Albert Wiersch

aubree
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Sun Sep 28, 2014 7:03 am

Re: web page title lenght

Post by aubree » Mon Sep 29, 2014 3:30 pm

Hello,

Thank you so much for your prompt answer which will save me a lot of time as CSE HTML Validator used to do.

Kind regards.

GA

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3412
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: web page title lenght

Post by Albert Wiersch » Mon Sep 29, 2014 5:54 pm

You're welcome!

By the way, I updated the code in my reply... I found a potential issue. :D
Image
Albert Wiersch

aubree
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Sun Sep 28, 2014 7:03 am

Re: web page title lenght

Post by aubree » Tue Sep 30, 2014 1:09 pm

Many thanks for the help which works perfectly and the update.

Kind regards.

GA

Post Reply