🔒 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
  • 744
    Views
  • 2
    Participants
Last reply from:
acdeleon

Trending Topics

Online now

Members online
816
Guests online
1,332
Total visitors
2,148

Forum statistics

Threads
2,285,431
Posts
29,030,065
Members
1,218,468
Latest member
MangKanorDaGreat
Back
Top