🔒 Closed How to read text in url??

Status
Not open for further replies.

acdeleon

Enthusiast
Hello gusto ko mangyare kapag ka click ng link mababasa nya ung url tapos mag aalert kapag specific na web ung nabuksan. Pero ang nangyayare e kada click ko lumalabas na accessing gma. Newbie lang po sa javascript.

Code:
$(document).on("click", "a", function() {
       //this == the link that was clicked
          var href = $(this).attr("href");
       if (window.location.protocol = 'https:'){
        if(href = "gmanetwork"){
            alert("Accessing Gma");
        }}
    else{
        alert("false");
    }
});
 
Ang kaso po kasi, nagset kayo ng condition na kapag 'https' ang protocol at value ng href attribute ay "gmanetwork", mag-aalert ng "Accessing Gma". Kaya yun ang palaging lumalabas.
 
Ang kaso po kasi, nagset kayo ng condition na kapag 'https' ang protocol at value ng href attribute ay "gmanetwork", mag-aalert ng "Accessing Gma". Kaya yun ang palaging lumalabas.

Nilagyan ko na ng == operator pero nawala ung pag alert?
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 758
    Views
  • 2
    Participants
Last reply from:
acdeleon

Trending Topics

Online now

Members online
886
Guests online
7,472
Total visitors
8,358

Forum statistics

Threads
2,329,489
Posts
29,248,465
Members
1,156,456
Latest member
jhaygalicia
Back
Top