w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Drag and drop cross domains, iframes, browsers windows
i think i found answer, drag and drop events works on iframe when open Chromium or Chrome without restrictions. chromium-browser --disable-web-security google-chrome --disable-web-security But if it is about Google Chrome "web security", why JavaScript Console do not show any info or warrning, and why drag and drop works excellent between two windows, drag and drop works even from firefox to chrome. edit: Google Chrome: "You are using an unsupported command-line flag: --disable-web-security. Stability and security will suffer." so flag works but is unsupported? I do not understand.

Categories : Javascript

"tel:" URLs lead to error page on non-mobile browsers
This german-language blog shows a neat workaround that'll work with CSS3-capable browsers. First, you make your tel: links look like normal text by default: a[href^="tel"]:link, a[href^="tel"]:visited, a[href^="tel"]:hover { text-decoration: none; color: #000; } Then, you give them link-like styling, but on mobile devices only: @media only screen and (max-device-width: 480px) { a[href^="tel"]:link, a[href^="tel"]:visited, a[href^="tel"]:hover { text-decoration: underline; color: blue; } } This has several caveats: It won't work with ancient desktop browsers (IE7 and such) - you'd have to give each tel: link a specific class for this to work with all browsers (instead of relying on the CSS3 href^="tel" bit) It won't remove the link behaviour, just

Categories : HTML

Javascript window.open function to open all urls in a json feed
for(var i=0; i<len; i++) { links[i].addEventListener('click', function(e){ window.open(this.href, '_blank', 'location=yes'); e.preventDefault(); }); }

Categories : Javascript

mod rewrite: handling sub domains, top level domains and query string
You just need one rule as QUERY_STRING is automatically copied over to after redirect. RewriteCond %{HTTP_HOST} !^example.org$ [NC] RewriteRule ^ http://example.org%{REQUEST_URI} [R=301,L]

Categories : Htaccess

Can a single hosts file entry contain multiple domains/sub-domains?
I found the solution. On IIS, I had to add https in bindings associating it to use IIS Development Certificate for SSL in my development environment. Also, in the process I found that both of the following wiil work for me. 127.0.0.1 somedomain.com, alternate-domain.com, subdomain.domain.com or 127.0.0.1 somedomain.com alternate-domain.com subdomain.domain.com Spaces and commas both work, and I can add multiple domains, subdomains combinations on same line. Also, if you are moving from a non-secure domain to secure domain/subdomain, SSL certificate needs to be setup on web server for it, else it would end up showing an error in the browser. Cheers!

Categories : Asp Net

Open URLs in a single UIWebView
You can't open more than one URL in a web view! Why not use more than one web view? EDIT : You're doing what? OK, a UIWebView is very much for rendering and displaying a web page. If you want to just send a web request, what's wrong with NSURLConnection or a library like AFNetworking?

Categories : IOS

Using relative urls with window.open
how to assign the url to the newly opened window You need to pass and URL to window.open() window.open('http://www.google.com');//will open www.google.com in new window. window.open('/relative_url'); //opens relatively(relative to current URL) specified URL Or, function OpenWindow(obj) { var w = window.open(); w.location = "hello.com/dummypage.html"; //how to assign the url to the newly opened window } Or, You can even say, w.location.assign("http://www.mozilla.org"); Refer Window.location

Categories : Javascript

How to handle URLs from Facebook Open Graph actions in iOS app
Facebook documents this here: https://developers.facebook.com/docs/ios/link-to-your-native-app-ios-sdk/ Just look under How to handle deep links to provide a more relevant user experience

Categories : IOS

Linkedin sharing urls / not parsing open graph
I checked again my html and found some warnings/errors in metadata. I fixed them and all work good. So the solution if you encounter the same problem: Check your html again and debug it. Even if the page load well in your browser, the LinkedIn parser is not as powerful in terms of small errors. This tool might help.

Categories : PHP

URLs that contain the text "feed" ask for an app to open with in Chrome for Android 4
The problem is not in the web app in any way. It's all the fault of RssDemon, the RSS android app. After uninstalling RssDemon, the problem goes away. It seems that RssDemon set up an URL intent filter so that links clicked on Chrome that had the text feed in them opened with RssDemon. Being a link, it's likely that Android also offers Chrome & Firefox as options to open it. The bad thing about that is that I can't do anything in my web app to avoid such a behaviour. The good things is that I don't have to :-) . It'll work fine for anyone without an app like RssDemon that installs such an intent filter. And you can't really protect from those, any app could set up a filter for any pattern and it'll be up to the user to decide then.

Categories : Android

HtmlUnit failing when it tries to open dead javascript links. Is there a way to tell it not to load specific URLs?
A brief look at the HtmlUnit JavaDoc seems to indicate that you should be able to use WebClientOptions#setExceptionOnFailingStatusCode(boolean) e.g., import com.gargoylesoftware.htmlunit.WebClient import com.gargoylesoftware.htmlunit.BrowserVersion import com.gargoylesoftware.htmlunit.html.HtmlPage object ScrapeTest { def main(args: Array[String]): Unit = { val pageurl = "http://www.eci-polldaymonitoring.nic.in/psl/" val client = new WebClient(BrowserVersion.INTERNET_EXPLORER_8) // Don't throw exception on failing status code client.getOptions.setExceptionOnFailingStatusCode(false) var response: HtmlPage = client.getPage(pageurl) println(response.asText()) } } If that doesn't work you could also try: WebClientOptions#setJavaScriptEnabled(boolean) WebCl

Categories : Java

My web page's layout only works on Chrome. It looks messy on other browsers. How do I format layout on CSS to accommodate for all browsers?
This is broken in all browsers. Its too hard to see what you want to achieve. To get this done Draw boxes on a sheet of paper to represent each element on your page. This is a process called wireframing. It is like an architect's plan. It also acts like a map helps to stop you getting lost in your code. Using floated divs with colour backgrounds recreate the box layout you drew on the paper. Test it in all browsers Once the boxes are are layout in a grid you like replace them with your images and links. Otherwise add a few images. Test it it all browsers. Add links. Test again in all browsers. Then add the video frame. The idea is take small steps get the code to work then move on. That way you only have the last few lines of code to look for errors.

Categories : CSS

Andriod-can i use in.myapp.app1 as package name instead of com.myapp.app1? because in domains are much cheaper than com domains?
I´m not sure what are you asking... Yes you can use whatever package name you want. When you create the new project modify the package name field. Like this: But when will you pay for the "domain"?? I am not understanding you...

Categories : Android

Python HTML parsing script that takes array of URLs and outputs specific data about each of the URLs
import urllib2 from bs4 import BeautifulSoup url = 'http://www.youtube.com/watch?v=QOdW1OuZ1U0' f = urllib2.urlopen(url) data = f.read() soup = BeautifulSoup(data) span = soup.find('span', attrs={'class':'watch-view-count'}) print '{}:{}'.format(url, span.text) If you do not want to use BeautifulSoup, you can use re: import urllib2 import re url = 'http://www.youtube.com/watch?v=QOdW1OuZ1U0' f = urllib2.urlopen(url) data = f.read() pattern = re.compile('<span class="watch-view-count.*?([d,]+).*?</span>', re.DOTALL) r = pattern.search(data) print '{}:{}'.format(url, r.group(1)) As for the outputs, I think you can store them in a csv file.

Categories : Python

How can i read a file for urls and then launch all the urls in browser using python
with open('Path/to/file', 'r') as content_file: content = content_file.read() urls = content.split() for url in urls: webbrowser.open(url) You can also try webbrowser.open(url, 2) to try to open the links in new tabs.

Categories : Python

Flask approach to creating URLs for resources whose URLs are different in production and in dev
The endpoint name needs to include the argument you want to pass to url_for. @bp.endpoint("/image_repo/<path:path>") def image_repo(path): if in_development(): return send_from_directory(current_app.instance_path, "<relative path>") else: return redirect("<cdn path>") EDIT: after re-reading the question, my original answer below isn't really a direct answer since you want to use a CDN, not just a separate location, sorry. Flask has a builtin solution for this called the instance folder. By default the instance folder will be next to your package (or module) during development, or in /<install prefix>/var/<package name> when installed in site-packages in production. You can access it's contents without knowing it's path with curren

Categories : Python

How to rewrite old urls to new urls to preserve Google Ranking
Note that Redirect is not part of mod_rewrite, it's part of mod_alias, and you don't need to turn on the rewrite engine to use it. If you wanted to "rewrite", as in, change the URL internally within the server, and the rest of the internet doesn't know it's been changed, then you'd use mod rewrite, and not a redirect: RewriteEngine On RewriteRule ^/?sompage/index.html$ /page.php?id=10 [L] If you want to redirect all requests to the new URL(s), then you can use Redirect just by itself. This lets the rest of the internet know that the URL has been changed and to stop going to the old one. With a 301, google knows that whatever metadata it has stored for the old URL should get migrated to the new URL when there is a 301 redirect (permanent): Redirect 301 /somepage/index.html /page.php?id

Categories : Htaccess

Redirect wordpress urls to joomla urls on the same domain
Use RedirectMatch to specify a pattern. RedirectMatch 301 /([^/]+)/([^/]+) /$1/category/id-$2.html Using mod_rewrite instead, you would be able to restrict the redirection to happen only when the URL path (i.e. the directory structure /eng/news/) physically does not exist. RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d # not a dir RewriteCond %{REQUEST_FILENAME} !-f # not a file RewriteRule ^([^/]+)/([^/]+)$ $1/category/id-$2.html [R=301,L] This assumes your .htaccess resides in the web root folder.

Categories : Wordpress

how to redirect users from old urls to new urls in SEO friendly manner
You should go with php just add following code in your old URL, it will redirect you to new URL new URL1 <?php header("Location: http://threads.example.com/IN/24/215/sample-thread.html"); ?> Do this for all pages

Categories : PHP

htaccess redirect urls to specific urls
Your regex should match the number, but not include it in the ()'s. ex: RewriteRule ^newsroom/press-release/item/[0-9]*-(.*)$ /press/$1 [R=301,NC,L] The [0-9]* matches an arbitrary length number, followed by the -. Only what's matched parens will be included in $1.

Categories : Htaccess

javascript/jquery : Window.open opens child window but after few seconds child window get automatically closed for some urls(for IE and chrome)
It's because this code is executed on init on https://wpc.gcsip.com/wpc/wpc page // check that this page is not in a subwindow (e.g. after a session time out) if ( window.opener ) { window.opener.location = "wpc"; window.opener.focus(); window.close(); }

Categories : Javascript

django - urls.py how to differ almost same urls from each other
Instead of .+ (which takes all characters up to the end), use w+: url(r'^bundesland/(?P<bundesland>w+)/$','home.views.func_a'), This will take one or more letters between the slashes.

Categories : Python

Getting No Urls to Fetch error on Nutch, even though there are Urls to fetch
Folks this is embarrassing. But the old nutch-not-crawling-because-it's-dismissining-urls addage of 'check your *-urlfilter.txt' file applies here. In my case i had an extra / in the url regex: +^http://([a-z0-9-A-Z]*.)*nutch.apache.org//([a-z0-9-A-Z]*/)* should have been +^http://([a-z0-9-A-Z]*.)*nutch.apache.org/([a-z0-9-A-Z]*/)*

Categories : Solr

Allow sub domains, but don't match www
You can add a ServerAlias before the VirtualDocumentRoot to catch the www. subdomain: ServerAlias www.* VirtualDocumentRoot /home/%-2.0.%-1.0/www The top example would catch all www. subdomains. To have the server behave as desired for all other subdomains, add another ServerAlias for all other subdomains like: ServerAlias * VirtualDocumentRoot /home/%-2.0.%-1.0/www/%-3.0 Hope this helps

Categories : Apache

How do I break out of an iFrame only for certain domains?
You can use another condition... var allowedDomains = ["stackoverflow.com"]; if (allowedDomains.indexOf(top.location.hostname) == -1 && top.location!= self.location) { top.location = self.location.href }

Categories : Javascript

Use cakephp session with two different domains
You need to connect to the first website's database and compare user session with user cookies. $db = new mysqli("localhost", "user", "pass", "db"); $id = $db->escape_string($_COOKIE["id"]); $session = $db->escape_string($_COOKIE["session"]); $check = $db->query("SELECT data FROM cake_sessions WHERE id = '" . $db->real_escape_string($id) . "'"); $checkarr = $check->fetch_assoc(); if($session == $checkarr["data"]) echo "logged"; not tested; also I'm not sure about cakephp authcookes, so they're probably wrong.

Categories : PHP

php copy() on same server different domains
Try editting your /var/www/vhosts/domain1.com/conf/vhost.conf file. If it doesn't exist, create it. Then add the following line: php_admin_value open_basedir "/var/www/vhosts/domain1.com/httpdocs:/var/www/vhosts/domain2.com/httpdocs" Save the file and then reload your apache configuration by running this command on the command line assuming you have priviledges: /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain1.com

Categories : PHP

multiple domains to have different page_on_front
If you check out the $_SERVER reserved variable in PHP here you can use the indices to check the URL and build a condition on it. In your case $_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI'] should do it. Example $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // $url returns http://domain.name/path If you have different domains forwarding to the same site and you want them to redirect, you could condition it so that when the domain name in the address bar matches a specific rule, then redirect. if($_SERVER['HTTP_HOST']=='domainA.com') { // do something with domainA } elseif($_SERVER['HTTP_HOST']=='domainB.com') { // do something with domainB } else { // do something with anything else }

Categories : Wordpress

Liferay overriding other domains
I'm not sure which part of the situation is unclear for you. I assume that all content is served through Apache, but portalsite.com is just proxied by apache, then relayed to Liferay. Assuming your portal runs on tomcat or another appserver that supports "AJP", read about mod_jk and how to use it to relay traffic to your portal. You'll end up with a configuration for a virtual host that is somehow similar to this (pseudo-code-configuration, only typed here, never tested, beware the typos...) # external "workers" configuration file for mod_jk, defining # connection properties for JkWorkersFile /path/to/your/jk/configuration <VirtualHost *:80> ServerName portalsite.com # all content should be forwarded to tomcat... JkMount /* your_tomcat_worker # ...except

Categories : Apache

Nodejs: want to map domains to server
If you use something like node http-proxy or nginx you can run each of the separate sites on different local ports and then map the domain name back. I use the http proxy but others love nginx. For that to work, you'll need to add DNS entries resolving to the IP address that your reverse proxy is running on. Then for example, the port 80 request will get mapped back to localhost:3000. This allows for each app to run in isolation and in separate processes from the other sites. They can't crash each other. You also don't have namespace issues where both apps claim the same path. My app.js for the http proxy looks like this: var proxyPort = 80; var http = require('http'); var httpProxy = require('http-proxy'); var options = { router: { 'localhost': '127.0.0.1:3000',

Categories : Node Js

Codeigniter: One site, two domains
In DB config file write a condition like this if(strpos($your_current_url, 'domain1') !== FALSE) : /* * DB CONFIG FOR DOMAIN1 */ elseif(strpos($your_current_url, 'domain2') !== FALSE) : /* * DB CONFIG FOR DOMAIN2 */ endif;

Categories : PHP

How many domains can be associated with an EC2 instance simultaneously?
The question isn't very clear but with just one ElasticIP you can host nearly infinite domain names to that IP. Then use Apache Virtuahosts, or IIS equivalent, to serve the websites. Just point the needed DNS records to the ElasticIP associated to the EC2 instance. There are many possible limitations to this, like storage, memory, SSL certificates on the same IP, etc.

Categories : Amazon

My website showing on two domains
I see you have put php tag so I would suggest something like this: if ($_SERVER['HTTP_HOST'] != 'rtc') { exit; } However its better to handle this kind of things in your http server settings. For example Apache has virtual named hosts.

Categories : PHP

Heroku with Multiple Domains
Before pushing Try this:- $ git remote add heroku git@heroku.com:yourappname.git ( to add current stack ) $ heroku keys:add ~/.ssh/id_rsa.pub (if stuck with key then add local machine key to heroku) $ git commit -m "message" $ git push heroku master <branch name>

Categories : Ruby On Rails

MAC OSX: Cannot run multiple local domains
I stumbled across this same problem... In your httpd-vhosts.conf file (/private/etc/apache2/extra/httpd-vhosts.conf after showing hidden files) add the following for each domain... <VirtualHost *:80> ServerName mysubdomain.dev CustomLog "/root/to/site/logs/mysubdomain.dev-access_log" combined ErrorLog "/root/to/site/logs/mysubdomain.dev-error_log" DocumentRoot "/root/to/site/mysubdomain.co.uk" <Directory "/root/to/site/mysubdomain.co.uk"> DirectoryIndex index.php Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> </VirtualHost> Then restart apache. Everything else you have seems to be the same as my setup. Make sure you have the correct permissi

Categories : Osx

Using any/fake domains with ejabberd
Your initial problems (unable to access the server by using m.chat.com) were almost certainly DNS issues, and it seems you have isolated that down to the time taken to update the record. Your second question - about the fact that you can name virtual hosts without restriction, is simple but interesting. What makes you think there should be any kind of restriction? It would be like you dictating that I can't save "m.chat.com" in a file on my disk, or that I can't send "m.chat.com" in a message across the internet. This is why DNS exists and is structured the way it is. Although I can tell my server that it hosts facebook.com, nobody will connect to it because the DNS record for facebook.com does not point at my server (users generally don't set the "connect host" manually). Which begs the

Categories : Facebook

Same session_id() values for different sub domains in IE
did you try to specify session cookie domain validity? //for page1.php session_set_cookie_params(time()+3600, "/", "abc.example.com"); //for page2.php session_set_cookie_params(time()+3600, "/", "xyz.example.com"); from php.net for function session_set_cookie_params Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to call session_set_cookie_params() for every request and before session_start() is called. This function updates the runtime ini values of the corresponding PHP ini configuration keys which can be retrieved with the ini_get().

Categories : PHP

Pow domains not loading in Chrome
Thanks to user Dan Reedy (see above) I was able to fix this by moving from OpenDNS to the Google DNS 8.8.8.8 and 8.8.4.4 settings. Now, pages load faster and Pow servers are working again. And they seem to actually load much faster. Awesome!

Categories : Ruby On Rails

jQuery: Set cookie for two domains
Well, if you want to extend it to the domain and not only a specific subdomain, just use domain : 'mydomain.com' instead of : domain: 'sub.mydomain.com'

Categories : Javascript

Magento and multiple domains
The apache virtual host setup is wrong. You need separate virtualhost entries for each domain as the following: <VirtualHost *:80> ServerAdmin webmaster@domain1.com DocumentRoot /var/www/http ServerName domain0.com </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@domain2.com DocumentRoot /var/www/http ServerName domain1.com </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@domain3.com DocumentRoot /var/www/http ServerName domai2.com </VirtualHost> And also the .htaccess file in your Magento root directory: SetEnvIf Host www.domain1.com MAGE_RUN_CODE=domain1_com SetEnvIf Host www.domain1.com MAGE_RUN_TYPE=website SetEnvIf Host ^domain1.com MAGE_RUN_CODE=domain1_com SetEnvIf Host ^domain1.com MAGE_RUN_

Categories : Apache



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.