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

Online now

Members online
459
Guests online
950
Total visitors
1,409

Forum statistics

Threads
2,275,076
Posts
28,960,477
Members
1,233,572
Latest member
linaresgmarc
Back
Top