'html'에 해당되는 글 6건

  1. 2021.08.18 [Java] html strip + multi whitespace strip
  2. 2020.05.08 [Javascript] Input text onsubmit 처리
  3. 2016.07.13 [HTML] window.history 스펙
  4. 2009.07.27 [PERL] HTML 메일 발송 테스트
  5. 2009.01.07 [펌]웹페이지 성능 향상
  6. 2008.07.24 [펌]html meta tags

[Java] html strip + multi whitespace strip

ITWeb/개발일반 2021. 8. 18. 11:30
content = content.replaceAll("<[^>]*>", "");  // html strip
content = content.replaceAll("( )+", " " );   // multi whitespace to single whitespace

사용할 일이 있는데 기억력이 떨어져서 기록 해 봅니다.

:

[Javascript] Input text onsubmit 처리

ITWeb/개발일반 2020. 5. 8. 09:56

Enter 입력을 통한 액션 수행을 onSubmit 이벤트가 onKeyDown 이벤트로 처리

<form onsubmit="return false;">

<input type="text" onkeydown="func(event);">

function func(e) {
  if ( e.keyCode === 13 ) {
    // 수행 할 내용 작성
  }
}

 

:

[HTML] window.history 스펙

ITWeb/개발일반 2016. 7. 13. 17:50

window.history 스펙이라기 보다 그냥 history interface 내용을 가져온 것입니다.


원문)

https://html.spec.whatwg.org/multipage/browsers.html#the-history-interface


내용)

enum ScrollRestoration { "auto", "manual" };

interface History {
  readonly attribute unsigned long length;
  attribute ScrollRestoration scrollRestoration;
  readonly attribute any state;
  void go(optional long delta = 0);
  void back();
  void forward();
  void pushState(any data, DOMString title, optional USVString? url = null);
  void replaceState(any data, DOMString title, optional USVString? url = null);
};


본 내용을 찾아본 이유는 location.href 값을 변경하고 싶었고 변경 시 reloading 되지 않도록 하기 위해서 입니다.

pushState, replaceState 를 이용하면 원하는 기능을 구현 할 수 있습니다.


설명)

window . history . length

Returns the number of entries in the joint session history.

window . history . scrollRestoration [ = value ]

Returns the scroll restoration mode of the current entry in the session history.

Can be set, to change the scroll restoration mode of the current entry in the session history.

window . history . state

Returns the current state object.

window . history . go( [ delta ] )

Goes back or forward the specified number of steps in the joint session history.

A zero delta will reload the current page.

If the delta is out of range, does nothing.

window . history . back()

Goes back one step in the joint session history.

If there is no previous page, does nothing.

window . history . forward()

Goes forward one step in the joint session history.

If there is no next page, does nothing.

window . history . pushState(data, title [, url ] )

Pushes the given data onto the session history, with the given title, and, if provided and not null, the given URL.

window . history . replaceState(data, title [, url ] )

Updates the current entry in the session history to have the given data, title, and, if provided and not null, URL.


:

[PERL] HTML 메일 발송 테스트

ITWeb/개발일반 2009. 7. 27. 15:01

아래 글에 이어서.. 추가 입니다.

참고 URL :
http://alma.ch/perl/Mail-Sendmail-FAQ.html
http://search.cpan.org/~mivkovic/Mail-Sendmail-0.79/Sendmail.pm

sub setSendMail {
    my $message = $_[0];

    %mail = (
                To           => 'to@email.com',
                From         => 'from@email.com',
                Subject      => 'TITLE',
                'Content-type'  => 'text/html; charset="UTF-8"',
                Message      => "<span style='font-size:11px; font-family:맑은 고딕, 돋움'>$message</span>"
            );

    if ( $message ) {
        sendmail(%mail) or die $Mail::Sendmail::error;
        print "OK. Log says:\n", $Mail::Sendmail::log;
    }
}

보시는 바와 같이 빨간 부분을 추가해 주시면 됩니다.
Content-type 앞뒤로 quotation 빼먹으시면 정상적으로 적용 안되니 유의 하세요.

:

[펌]웹페이지 성능 향상

Legacy 2009. 1. 7. 13:30

http://msdn.microsoft.com/ko-kr/magazine/dd188562.aspx

 

한번 가볍게 읽어 보세요. ^^*

 

1.      충분한 포트 열기

2.      다운로드하는 작은 파일 수를 제한

3.      JavaScript 파일을 JavaScript 엔진 외부에서 로드

4.      연결 유지 사용

5.      네트워크 정체 현상 식별

6.      네트워크 MTU(최대 전송 단위) TCP 크기 늘리기

7.      서버 정체 현상 식별

8.      불필요한 왕복 확인

9.      만료 날짜 설정

10.  리디렉션에 대한 재고

11.  압축 사용

12.  CSS 편집

 

더불어 비교해서 야후 닷컴에 근무하는 친구(제 친구는 아니구요.. )가 쓴 책인데요.

http://stevesouders.com/examples/rules.php

http://video.yahoo.com/video/play?vid=1040890

:

[펌]html meta tags

ITWeb/개발일반 2008. 7. 24. 12:03
아직도 html 코드에 기본이 되는 태그들을 안쓰시는 분들이 많더군요.
기본적으루 좀 넣어 주자구요.. ^^*
사용자를 위한 배려 아닐런지요..
특히 커뮤니티 서비스를 만드시는 분들은.. 기본 기본..

no cache 넣어 주고 keyword 넣어 주고 description 넣어 주고... 이게 어렵나.. 흠..
이도 저도 싫으면.. no cache 라도..

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 1999 00:00:00 GMT">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">


ref. http://www.i18nguy.com/markup/metatags.html


Tag NameExample(s)Description
Author<META NAME="AUTHOR" CONTENT="Tex Texin"> The author's name.
cache-control<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.
Public - may be cached in public shared caches
Private - may only be cached in private cache
no-Cache - may not be cached
no-Store - may be cached but not archived

The directive CACHE-CONTROL:NO-CACHE indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the PRAGMA:NO-CACHE.
Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.
Also see EXPIRES.
Note: It may be better to specify cache commands in HTTP than in META statements, where they can influence more than the browser, but proxies and other intermediaries that may cache information.

Content-Language<META HTTP-EQUIV="CONTENT-LANGUAGE"
CONTENT="en-US,fr">
Declares the primary natural language(s) of the document. May be used by search engines to categorize by language.
CONTENT-TYPE<META HTTP-EQUIV="CONTENT-TYPE"
CONTENT="text/html; charset=UTF-8">
The HTTP content type may be extended to give the character set. It is recommended to always use this tag and to specify the charset.
Copyright<META NAME="COPYRIGHT" CONTENT="&copy; 2004 Tex Texin"> A copyright statement.
DESCRIPTION<META NAME="DESCRIPTION"
CONTENT="...summary of web page...">
The text can be used when printing a summary of the document. The text should not contain any formatting information. Used by some search engines to describe your document. Particularly important if your document has very little text, is a frameset, or has extensive scripts at the top.
EXPIRES<META HTTP-EQUIV="EXPIRES"
CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
The date and time after which the document should be considered expired. An illegal EXPIRES date, e.g. "0", is interpreted as "now". Setting EXPIRES to 0 may thus be used to force a modification check at each visit.
Web robots may delete expired documents from a search engine, or schedule a revisit.

HTTP 1.1 (RFC 2068) specifies that all HTTP date/time stamps MUST be generated in Greenwich Mean Time (GMT) and in RFC 1123 format.
RFC 1123 format = wkday "," SP date SP time SP "GMT"

wkday = (Mon, Tue, Wed, Thu, Fri, Sat, Sun)
date = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982)
time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; 00:00:00 - 23:59:59
month = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)

Keywords<META NAME="KEYWORDS"
CONTENT="sex, drugs, rock & roll">
The keywords are used by some search engines to index your document in addition to words from the title and document body. Typically used for synonyms and alternates of title words. Consider adding frequent misspellings. e.g. heirarchy, hierarchy.
PRAGMA NO-CACHE<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> This directive indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the CACHE-CONTROL:NO-CACHE directive and is provided for backwards compatibility with HTTP/1.0.
Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.
HTTP/1.1 clients SHOULD NOT send the PRAGMA request-header. HTTP/1.1 caches SHOULD treat "PRAGMA:NO-CACHE" as if the client had sent "CACHE-CONTROL:NO-CACHE".
Also see EXPIRES.
Refresh<META HTTP-EQUIV="REFRESH"
CONTENT="15;URL=http://www.I18nGuy.com/index.html">
Specifies a delay in seconds before the browser automatically reloads the document. Optionally, specifies an alternative URL to load, making this command useful for redirecting browsers to other pages.
ROBOTS <META NAME="ROBOTS" CONTENT="ALL">

<META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW">

<META NAME="ROBOTS" CONTENT="NOINDEX,FOLLOW">

<META NAME="ROBOTS" CONTENT="NONE">
CONTENT="ALL | NONE | NOINDEX | INDEX| NOFOLLOW | FOLLOW | NOARCHIVE"
default = empty = "ALL"
"NONE" = "NOINDEX, NOFOLLOW"

The CONTENT field is a comma separated list:
INDEX: search engine robots should include this page.
FOLLOW: robots should follow links from this page to other pages.
NOINDEX: links can be explored, although the page is not indexed.
NOFOLLOW: the page can be indexed, but no links are explored.
NONE: robots can ignore the page.
NOARCHIVE: Google uses this to prevent archiving of the page. See http://www.google.com/bot.html

GOOGLEBOT <META NAME="GOOGLEBOT" CONTENT="NOARCHIVE"> In addition to the ROBOTS META Command above, Google supports a GOOGLEBOT command. With it, you can tell Google that you do not want the page archived, but allow other search engines to do so. If you specify this command, Google will not save the page and the page will be unavailable via its cache.
See Google's FAQ.

: