Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JavaScript + if-else + IP

Empfohlene Antworten

Veröffentlicht

Hallo liebe NG,

ich würds ja lieber in Perl machen, weil ich in JS total doof bin aber egal. Mein existenzeilles Problem ist: Ich möchte eine Webseite öffnen, die Webseite soll mittels eines JavaScripts (da keine CGI-Rechte)ermitteln welche IP die anfrage tätigt - jetzt soll entschieden werden welche seite aufgebaut werden soll:

Hier mein Vorschlag - funktioniert aber noch nicht - so hab ichs mir erstmal vorgestellt - habt ihr bessere Ideen?

<html>

<head></head>

<body>

if ( $ENV{'REMOTE_ADDR'} == 10.1.1.2 )

{

<h1>Du bist boese</h1>

}

else

{

<h1>Du bist lieb</h1>

}

</body></html>

* $ENV{'REMOTE_ADDR'} -> ist eine Umgebungsvariable die die IP-Adresse des Rechners ermittelt der die Anfrage macht (müsste jeder Webserver kennen)

euer Raudi

Ohne mich jetzt festlegen zu wollen: Ich glaube mit JavaScript kann man keine IP-Adressen ermitteln. Zumindest kenne ich keinen entsprechenden Befehl.

MfG

Original erstellt von Moon21:

<STRONG>Ohne mich jetzt festlegen zu wollen: Ich glaube mit JavaScript kann man keine IP-Adressen ermitteln. Zumindest kenne ich keinen entsprechenden Befehl.

MfG</STRONG>

Das ist richtig. Du hast mit Client-JavaScript keine Möglichkeit, an die IP heranzukommen. Per Applet sollte es aber gehen.

Gruss

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.