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

Trending Topics

Online now

Members online
1,108
Guests online
3,625
Total visitors
4,733

Forum statistics

Threads
2,306,263
Posts
29,170,742
Members
1,194,750
Latest member
cardopo
Back
Top