Spec-Zone.ru › ColdFusion

location

Stops execution of the current page and redirects to the given URL.

location(url [, addtoken] [, statuscode]) → returns void

  • CF9+
  • Lucee
  • BL 1.0.0+
  • See Also: cfscript cflocation

    Argument Reference

    url string
    Required

    URL of web page to open.

    addtoken boolean
    Default: true

    clientManagement must be enabled (see cfapplication).

    statuscode numeric
    Default: 302

    The HTTP status code
    Values:
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307

    Compatibility

    ColdFusion:

    Version 9+ Implemented as both a function and an alias to the cflocation tag in script, so named parameters can be used prior to CF2018+. CF11+ addtoken default value is false when Secure Profile is enabled

    Examples
    Sample code invoking the location function

    Simple Example

    Relocates to a different page if user is not logged in.

    if (!structKeyExists(session, "userID") {
    	location("login.cfm");
    }

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/location

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API