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

Trending Topics

Online now

Members online
322
Guests online
5,232
Total visitors
5,554

Forum statistics

Threads
2,350,860
Posts
29,368,998
Members
1,087,943
Latest member
geba elimnyama
Back
Top