How do I check if url match

0 favourites
  • 12 posts
From the Asset Store
snake and ladder game with two characters: turtle and rabbit!
  • hi to all, i would like to know how to do this:

    i have an extenrnal file txt, who contains a list of urls, in my app i added ajax and browser object, how to say, when the url match to one of thoses inside the file.txt, then web browser redirect to a special site?

    thanks

  • What do you mean by "when the url match to one of thoses inside the file.txt" ?

    How are you planning to check that?

  • maybe with the list object?

  • Question is..

    You say the url has to match, so I guess you want to compare the url to something else?

    How are you trying to compare the url?

    Through Ajax you can import the textfile and use it in Construct2, then you can use (part of) it, but to know what method would be best for you it would be nice to know how you want to use the information in the text..

  • thanks, this is what i have at the moment:

    a file.txt who contain:

    http://url1.com/

    http://url2.com/

    etc...

    what i want is, when the browser run, if the url typed by the user, match to one on those inside the file.txt, then it redirect to a specific url

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could use:

    find(src, text)

    where src would be Ajax.lastdata and text would be the user typed url..

    System compare: find(src, text) is not equal to -1 - means the user typed url exists within the text..

    trouble would be that also a half entered url would count as being in the text..

    So I guess putting your Ajax.lastdata into an array and looping through that to see if it exists would be better..

  • i was thinking if its possible to make a chrome extension with construct2, isaw its possible to make apps "games" for the webstore, it has to be possible too, to make chrome extensions,

    i need to make a chrome extension, and at the moment im stuck, because my extension has just one function, it blocks millions of urls updated every week, at the moment my file who contains thes urls is up to 5mb and i need to store that on a server :s

  • I don't think C2 would be the best option for creating something like that..

  • Doesn't this program do exactly what you'd like to do?

    https://chrome.google.com/webstore/deta ... fdeojpcgbh

  • no, i know, i was watching all the concurrent products, my extension is fully automated, the user install it, and thats it, it blocks the urls i add to the database, the user has just to click "one time" and its done

  • i started doing my chrome extension inside construct2 and this is what i have at tthe moment, the app start without any problem but now im thinking how to run my functions :s

    http://postimg.org/image/5hpv9o5hn/full/

  • so ok i made the app for the webstore chrome, actually the manifest.json is the same as a classic chrome extension, but why the manifest.json of construct 2 dont run the app, if i add that as an extension?

    actually the app work only if i click on the icon, when i add the app as an extension :s

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)